-
Notifications
You must be signed in to change notification settings - Fork 201
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expose wd
via scheduler
#1571
base: master
Are you sure you want to change the base?
Expose wd
via scheduler
#1571
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -479,3 +479,11 @@ def check_pause(self, rid): | |
return False | ||
return r.priority_key() > run.priority_key() | ||
raise KeyError("RID not found") | ||
|
||
def get_wd(self, rid): | ||
"""Returns the ``wd`` attribute of the run with the specified RID.""" | ||
for pipeline in self._pipelines.values(): | ||
if rid in pipeline.pool.runs: | ||
run = pipeline.pool.runs[rid] | ||
return run.wd | ||
raise KeyError("RID not found") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Matter of taste: why not? try:
return pipeline.pool.runs[rid].wd
except KeyError:
raise KeyError("RID not found") # [from None] There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was going for consistency with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually, if you put this whole try/except inside the loop then I don't think it would work since this would raise a key error for every pipeline that doesn't contain that RID, even if there's one that does. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good point indeed, sorry. Missed one level of indentation. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Probably a moot point anyway as it looks like this PR will be rejected for release-5, and unnecessary for master/future release-6 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wd
should be spelled out if this is part of the user-facing API. Attributes ofartiq.master.scheduler.Run
are not documented.