Skip to content
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

ENH: small tune ups to "jobs -s" output in case of missing external (datalad) #516

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions reproman/interface/jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

from reproman.dochelpers import exc_str
from reproman.interface.base import Interface
from reproman.support.external_versions import MissingExternalDependency
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left-over import from earlier commit

from reproman.support.jobs.local_registry import LocalRegistry
from reproman.support.jobs.orchestrators import ORCHESTRATORS
from reproman.resource import get_manager
Expand Down Expand Up @@ -97,11 +98,16 @@ def show_oneline(job, status=False):
"""
fmt = "{status}{j[_jobid]} on {j[resource_name]} via {j[submitter]}$ {cmd}"
if status:
orc = _resurrect_orc(job)
orc_status = orc.status
_, queried_status = orc.submitter.status
if orc_status == queried_status:
# Drop repeated status (e.g., our and condor's "running").
try:
orc = _resurrect_orc(job)
orc_status = orc.status
_, queried_status = orc.submitter.status
if orc_status == queried_status:
# Drop repeated status (e.g., our and condor's "running").
queried_status = None
except Exception as exc:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As the failing tests indicate, this interferes with the expected error handling in the outer level. So I think the options are (1) broaden the existing handling to catch either the MissingExternalDependency you were originally interested in (my preference) or a blanket exception or (2) more comprehensively rework the handling around orc resurrection/status query, adjust the tests, maybe rethink the outer handling. I don't see a big advantage of the latter, so I'd lean to the narrow variant of 1.

If 2 is the choice, show should also be considered.

lgr.warning(exc_str(exc))
orc_status = "N/A"
queried_status = None
stat = "[status: {}{}] ".format(
orc_status,
Expand Down
3 changes: 2 additions & 1 deletion reproman/support/jobs/orchestrators.py
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,8 @@ def __init__(self, resource, submission_type, job_spec=None,
resurrection=False):
if not external_versions["datalad"]:
raise MissingExternalDependency(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a note: the datalad-bump branch already switched this over to external_versions.check(), which results results in .name being set in the MissingExternalDependency instance.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh cool, One more reason to have that pr merged, which I guess I will do with adding datalad rc into some dependency within setup.py .

"DataLad is required for orchestrator '{}'".format(self.name))
"datalad",
msg="Required for orchestrator '{}'".format(self.name))

super(DataladOrchestrator, self).__init__(
resource, submission_type, job_spec, resurrection=resurrection)
Expand Down