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

Conversation

yarikoptic
Copy link
Member

@yarikoptic yarikoptic commented May 26, 2020

See individual commits. Now (original version) would show

$> reproman --dbg jobs -s
[status: N/A - needs datalad] 20200107-213600-f814 on smaug via condor$ '{inputs}' '{outputs}' participant --participan...
...

instead of immediately crashing with

$> reproman  jobs -s    
2020-05-25 20:18:57,108 [ERROR  ] DataLad is required for orchestrator 'datalad-pair-run' is missing. [orchestrators.py:__init__:488] (MissingExternalDependency) 

edit1: pushed fb4e2a6 which would just catch all exceptions and issue warning while providing NA for the status

…xternalDependency

Otherwise str() of that exception looks like

   DataLad is required for orchestrator datalad-pair-run is missing.

and it is impossible to obtain the "name" of the missing external module.
Well, ideally this exception should have kept msg as the first arg
instead of making it into the "name", but oh well -- that is how it is now
…s mising

Instead of crashing altogether demanding to install the needed dependency.
Since it is just a show_oneline, and not programmable interface, I thought
it would be better to report that something is missing but continue otherwise
so other jobs statuses could be seen
That would make it obvious although not as pretty, but would not require
each and other exception differential handling

examples:

    $> reproman --dbg jobs -s
    2020-05-25 20:31:09,793 [WARNING] datalad is missing. Required for orchestrator 'datalad-pair-run' [orchestrators.py:__init__:488]
    [status: N/A] 20200107-213600-f814 on smaug via condor$ '{inputs}' '{outputs}' participant --participan...

    $> reproman --dbg jobs -s
    [status: succeeded] 20200108-124152-a708 on smaug via condor$ '{inputs}' '{outputs}' participant --participan...
    2020-05-25 20:32:59,254 [WARNING] [Errno 2] No such file or directory: '/home/yoh/.reproman/run-root/07ce9f04-9eb5-11ea-be9b-ff519d1f6bc9' [subprocess.py:_execute_child:1702]
    [status: N/A] 20200525-142526-10f0 on local via local$ '{inputs}' '{outputs}' participant --participan...
@codecov
Copy link

codecov bot commented May 26, 2020

Codecov Report

Merging #516 into master will increase coverage by 0.11%.
The diff coverage is 77.77%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #516      +/-   ##
==========================================
+ Coverage   89.47%   89.59%   +0.11%     
==========================================
  Files         148      148              
  Lines       12290    12295       +5     
==========================================
+ Hits        10997    11016      +19     
+ Misses       1293     1279      -14     
Impacted Files Coverage Δ
reproman/support/jobs/orchestrators.py 91.84% <ø> (ø)
reproman/interface/jobs.py 97.14% <77.77%> (-1.86%) ⬇️
...eproman/interface/tests/test_backend_parameters.py 100.00% <0.00%> (+4.34%) ⬆️
reproman/tests/skip.py 97.75% <0.00%> (+4.49%) ⬆️
reproman/distributions/tests/test_venv.py 98.07% <0.00%> (+10.57%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b6528a1...fb4e2a6. Read the comment docs.

@@ -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 .

@@ -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

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants