New issue
Advanced search Search tips

Issue 788282 link

Starred by 1 user

Issue metadata

Status: Assigned
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 3
Type: Bug



Sign in to add a comment

factory: Should not load region database unless really needed

Project Member Reported by hungte@chromium.org, Nov 24 2017

Issue description

In py/test/l10n/regions.py, it has few two variables

 REGIONS, REGIONS_LIST UNCONFIRMED_REGIONS_LIST

The definition of regions were inside regions.py but it's now moved to external (either src/platform2/regions/regions.py or /usr/share/misc/cros-regions.json), so constructing these variables may be pretty slow, and causing 'import regions' also slow.

And the thing even worse is that, DUT info loads hwid, hwid loads yaml_tags, yaml_tags loads regions for building the magic !region tag.

Which means any projects trying to create DUT instance will load JSON database or invoke regions.py.

We should change these.

1. Shopfloor code has been isolated so no one will be using regions.py outside our factory repo, so we can remove REGIONS now.
2. Probably make those variables into functions that will memorize the results by default.
 

Comment 1 by hungte@chromium.org, Nov 24 2017

Owner: youcheng@chromium.org
temporarily assign to youcheng.
Status: Assigned (was: Untriaged)
Labels: Hotlist-GoodFirstBug
Owner: hsinyi@chromium.org
re-assign to nooger as practice.

Comment 4 by hungte@chromium.org, Today (86 minutes ago)

Owner: shihyingchen@chromium.org

Sign in to add a comment