Closed
Bug 1278999
Opened 8 years ago
Closed 8 years ago
taskcluster/taskgraph/kind/legacy.py should not assume task.payload.artifacts is a dictionary
Categories
(Taskcluster :: Services, defect)
Taskcluster
Services
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: pmoore, Assigned: pmoore)
References
Details
Attachments
(1 file, 2 obsolete files)
1.35 KB,
patch
|
wcosta
:
review+
|
Details | Diff | Splinter Review |
In docker worker, task.payload.artifacts is a dictionary. In generic worker, it is a list. This needs to be cleaned up separately, but for now we should allow for both forms to exist, until generic worker aligns, or until tasks are migrated from generic worker -> taskcluster worker.
Assignee | ||
Comment 1•8 years ago
|
||
Hey Wander, Could you take a look at this (simple) fix, as dustin is on PTO for the next days? Thanks! Pete
Comment 2•8 years ago
|
||
Comment on attachment 8761514 [details] [diff] [review] bug1278999_gecko_v1.patch Review of attachment 8761514 [details] [diff] [review]: ----------------------------------------------------------------- ::: taskcluster/taskgraph/kind/legacy.py @@ +210,5 @@ > + except: > + # generic worker > + values = artifacts > + > + for artifact in values: How about: if hasattr(artifacts, "values"): artifacts = artifacts.values()
Comment 3•8 years ago
|
||
tested wcosta's suggestion here: https://treeherder.mozilla.org/#/jobs?repo=try&revision=b36aa7a839c0 seems to work...
Assignee | ||
Comment 4•8 years ago
|
||
(In reply to Wander Lairson Costa [:wcosta] from comment #2) > Comment on attachment 8761514 [details] [diff] [review] > bug1278999_gecko_v1.patch > > Review of attachment 8761514 [details] [diff] [review]: > ----------------------------------------------------------------- > > ::: taskcluster/taskgraph/kind/legacy.py > @@ +210,5 @@ > > + except: > > + # generic worker > > + values = artifacts > > + > > + for artifact in values: > > How about: > > if hasattr(artifacts, "values"): > artifacts = artifacts.values() It is an interesting suggestion, many thanks for diving into this. The only thing I don't like about the alternative suggestion is that it can be misleading at a glance. First artifacts is assigned in line 203: artifacts = task_def['payload']['artifacts'] and then later, it gets "moved" to artifacts.values() a few lines further down. So a cursory glance at the code you might think that artifacts was task_def['payload']['artifacts'] without spotting it got moved on a couple of lines later. With my version, there is an intermediate variable, so you can't make this mistake. Also you clearly see from the comments the two forks the code can take - 1 route for generic worker, and 1 route for docker worker. It just feels more readable, although I see your version is more concise.
Comment 5•8 years ago
|
||
Comment on attachment 8761514 [details] [diff] [review] bug1278999_gecko_v1.patch Review of attachment 8761514 [details] [diff] [review]: ----------------------------------------------------------------- ::: taskcluster/taskgraph/kind/legacy.py @@ +206,5 @@ > > + try: > + # docker worker > + values = artifacts.values() > + except: "except:" catches everything, even syntax errors, better to use "except AttributeError:" @@ +207,5 @@ > + try: > + # docker worker > + values = artifacts.values() > + except: > + # generic worker This also holds for taskcluster-worker
Assignee | ||
Comment 6•8 years ago
|
||
Compromise! :-)
Attachment #8761514 -
Attachment is obsolete: true
Attachment #8761514 -
Flags: review?(wcosta)
Attachment #8761585 -
Flags: review?(wcosta)
Updated•8 years ago
|
Attachment #8761585 -
Flags: review?(wcosta) → review+
Assignee | ||
Comment 7•8 years ago
|
||
Same as previous patch, but forgot r=wcosta in commit message, so reattaching with updated commit message. =)
Attachment #8761585 -
Attachment is obsolete: true
Assignee | ||
Updated•8 years ago
|
Attachment #8761614 -
Flags: review?(wcosta)
Assignee | ||
Updated•8 years ago
|
Keywords: checkin-needed
Updated•8 years ago
|
Attachment #8761614 -
Flags: review?(wcosta) → review+
Pushed by cbook@mozilla.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/fd3e2d8ed90a handle generic worker style artifacts (list not dictionary). r=wcosta
Keywords: checkin-needed
Comment 9•8 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/fd3e2d8ed90a
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Updated•5 years ago
|
Component: Platform and Services → Services
You need to log in
before you can comment on or make changes to this bug.
Description
•