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

python: return JobID from flux.job.submit, not int #4134

Merged
merged 3 commits into from
Feb 15, 2022

Conversation

grondo
Copy link
Contributor

@grondo grondo commented Feb 15, 2022

As described in #3614, it would be much more convenient to return a JobID instead of int from flux.job.submit and flux.job.SubmitFuture.get_id, with no discernable drawbacks.

This PR updates these Python calls to return a JobID object. This should not break any existing code, since JobID() on an instance of JobID should work fine.

Once the calls are converted, unnecessary use of JobID() is removed in flux-mini.py and throughput.py.

Copy link
Member

@chu11 chu11 left a comment

Choose a reason for hiding this comment

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

LGTM

@grondo
Copy link
Contributor Author

grondo commented Feb 15, 2022

Thanks, @chu11!

Problem: The Flux jobid returned from job.submit() or
SubmitFuture.get_id() is an int, when it would be much more convenient
to return an instance of the JobID class.

Return a JobID object from job.submit_get_id() so that
SubmitFuture.get_id() and job.submit() return JobID instead of int.

Fixes flux-framework#3614
Problem: The JobID() constructor is used in flux-mini.py to return a
JobID object from the return value of flux.job.SubmitFuture.get_id(),
but this function already returns a JobID object.

Remove unnecessary calls to JobID().
Problem: The throughput.py test script uses the JobID constructor
to return a JobID object from the flux.job.SubmitFuture.get_id() call,
but this function already returns a JobID object.

Remove the unnecessary call the JobID().
@codecov
Copy link

codecov bot commented Feb 15, 2022

Codecov Report

Merging #4134 (fe2dbce) into master (10ad36b) will increase coverage by 0.56%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master    #4134      +/-   ##
==========================================
+ Coverage   83.31%   83.88%   +0.56%     
==========================================
  Files         376      374       -2     
  Lines       63036    54917    -8119     
==========================================
- Hits        52521    46065    -6456     
+ Misses      10515     8852    -1663     
Impacted Files Coverage Δ
src/bindings/python/flux/job/submit.py 94.28% <100.00%> (+0.16%) ⬆️
src/cmd/flux-mini.py 91.86% <100.00%> (-0.15%) ⬇️
src/common/libutil/setenvf.c 0.00% <0.00%> (-100.00%) ⬇️
src/common/libpmi/pmi_strerror.c 66.66% <0.00%> (-8.34%) ⬇️
src/common/libutil/wallclock.c 50.00% <0.00%> (-7.90%) ⬇️
src/cmd/builtin/heaptrace.c 57.44% <0.00%> (-5.52%) ⬇️
src/common/libutil/xzmalloc.c 51.51% <0.00%> (-5.25%) ⬇️
src/common/libcontent/content-util.c 50.00% <0.00%> (-4.55%) ⬇️
src/common/libschedutil/hello.c 70.96% <0.00%> (-4.04%) ⬇️
src/cmd/builtin/content.c 73.87% <0.00%> (-3.99%) ⬇️
... and 306 more

@mergify mergify bot merged commit db2c75e into flux-framework:master Feb 15, 2022
@grondo grondo deleted the issue#3614 branch February 25, 2022 21:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants