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

job-info: misc cleanup #5586

Merged
merged 9 commits into from
Nov 22, 2023
Merged

job-info: misc cleanup #5586

merged 9 commits into from
Nov 22, 2023

Conversation

chu11
Copy link
Member

@chu11 chu11 commented Nov 21, 2023

Misc cleanup, mostly coming from comments in #5467

Note that I just saw #5585 got submitted, dunno if there are conflicts ...

@grondo
Copy link
Contributor

grondo commented Nov 21, 2023

Note that I just saw #5585 got submitted, dunno if there are conflicts ...

Unlikely. That one only touches the kvs-watch module.

Copy link
Member

@garlick garlick left a comment

Choose a reason for hiding this comment

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

Looks good, just one nit.

cmpmsg = flux_msglist_next (uc->msglist);
}
if (cancel)
flux_msglist_cancel (uc->ctx->h, uc->msglist, msg);
Copy link
Member

Choose a reason for hiding this comment

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

flux_msglist_cancel() returns -1 if the respond fails so probably that should be logged, like above only ideally with a bit better error message.

Problem: After a failed call to strdup(), code sets errno to ENOMEM.
This isn't necessary because strdup() does this already.

Remove the manual setting of errno to ENOMEM.
Problem: A call to json_pack_ex() + json_dumps() + flux_msg_set_string()
can be simplified via flux_msg_vpack().

Simplify code and just call flux_msg_vpack().
Problem: Code for dealing with update watch cancellations / disconnects
can be greatly simplified by using the flux_msglist_cancel() and
flux_msglist_disconnect().  In addition, ENODATA should only be returned
on cancels, not disconnects.

Simplify code by using flux_msglist_cancel() and flux_msglist_disconnect().
This cleanup also corrects the error where ENODATA is returned on disconnects.
Problem: Some code in job-info's update-watch code uses internal
eventlog parsing functions that serve no benefit.

Use libeventlog functions to parse the eventlog, thus cleaning up
the code.
Problem: Several eventlog utility functions in job-info are prefixed
with "eventlog_".  By using this naming convention, readers may think
these functions are from the libeventlog library.

Rename the functions to remove the "eventlog_" prefix.
Problem: In the job-info guest-watch code, the bool value "cancel"
and send_cancel() function are a little ambiguous in what they do.

Rename the variable "cancel" to "eventlog_watch_canceled" and rename the function
send_cancel() to send_eventlog_watch_cancel().
Problem: In the job-info watch code, the bool value "cancel"
and watch_cancel() function are a little ambiguous in what they do.

Rename the variable "cancel" to "kvs_watch_canceled" and rename the function
watch_cancel() to send_kvs_watch_cancel().
Problem: In guest-watch and watch code, ENODATA is sent to the original
caller both when the stream is canceled and when it is disconnected.  It
should not be sent when it is disconnected.

Add an internal flag to only send ENODATA when the watch stream is
canceled, not when it is disconnected.
Problem: A function definition exceeded 80 characters, which violates
RFC7.

Fix the code style.
@chu11
Copy link
Member Author

chu11 commented Nov 22, 2023

@garlick thanks! Fixed that and I also noticed a line > 80 chars near that, so I added that in a dumb fix at the top of this commit series.

Setting MWP

Copy link

codecov bot commented Nov 22, 2023

Codecov Report

Merging #5586 (df00e22) into master (420e8e7) will decrease coverage by 0.05%.
The diff coverage is 70.00%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5586      +/-   ##
==========================================
- Coverage   83.45%   83.41%   -0.05%     
==========================================
  Files         486      486              
  Lines       82450    82456       +6     
==========================================
- Hits        68810    68781      -29     
- Misses      13640    13675      +35     
Files Coverage Δ
src/modules/job-info/util.c 66.66% <100.00%> (ø)
src/modules/job-info/update.c 76.20% <72.22%> (-1.18%) ⬇️
src/modules/job-info/watch.c 69.00% <73.68%> (+0.07%) ⬆️
src/modules/job-info/guest_watch.c 74.11% <65.00%> (-0.18%) ⬇️

... and 10 files with indirect coverage changes

@mergify mergify bot merged commit 5a0b0b5 into flux-framework:master Nov 22, 2023
@chu11 chu11 deleted the pr5467_fixes branch November 22, 2023 20:49
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.

3 participants