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-list: split out job information into new files #4575

Merged
merged 4 commits into from
Sep 20, 2022

Conversation

chu11
Copy link
Member

@chu11 chu11 commented Sep 15, 2022

This is a general refactoring PR.

I actually did some similar refactoring in #4336

I did some similar refactoring in a (now tabled) PR for #4404

@garlick commented on some potential refactoring in #4555

So thus this refactoring, and why I put it in a separate PR.

I could add some unit tests to capture some worst offending failure cases (e.g. like jobspec that is just a curly brace), but didn't given its limited coverage increase. Some of this is already handled in sharness tests.

@grondo
Copy link
Contributor

grondo commented Sep 19, 2022

I thought the idea proposed in #4555 was to split out some of the common R and jobspec "parsing" into a reusable library (i.e. that could eventually be reused by some other facility in flux-core if necessary) Is this just a stepping stone to that goal since here it seems like all that is done so far is to move some code into a new source file?

@chu11
Copy link
Member Author

chu11 commented Sep 19, 2022

yeah, this is just moving in that general direction. The main reason I did this is b/c I sort of had the same "move data structures into new files" in two separate PRs, so I felt this refactoring was sort of necessary to avoid more conflicts going forward.

@grondo
Copy link
Contributor

grondo commented Sep 20, 2022

Ok, that seems reasonable. We should indeed try to refactor the jobspec/R parsing into 'struct job' into reusable code with unit tests at some point though.

Copy link
Contributor

@grondo grondo left a comment

Choose a reason for hiding this comment

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

Since the only purpose here is to move code to a new file, seems good to me.

Problem: In several locations an extra level of indirection is
used to get the 'jsctx' value.

Solution: Get the `jsctx` value more directly.
Problem: struct job currently caches two sub-objects of
the jobspec in jobspec_job and jobspec_cmd.  However, these two
sub objects are never used.

Solution: Instead store a reference to the jobspec in struct job.  Remove
the references to the sub objects.
Problem: `struct job` in job_state.h contains `struct list_ctx` from
job-list.h.  `struct list_ctx` in job-list.h contains
`struct job_state_ctx` from `job_state.h`.  This circular dependency
isn't a problem at the moment, but it can become an issue in the
future when future services are added.

In addition, job_state.[ch] files are getting long.

Solution: Move struct job and job create/destroy functions into
their own files.  Also move jobspec parsing and R parsing into the
new file.
@codecov
Copy link

codecov bot commented Sep 20, 2022

Codecov Report

Merging #4575 (e5d3bc5) into master (80819e2) will decrease coverage by 0.00%.
The diff coverage is 80.45%.

❗ Current head e5d3bc5 differs from pull request most recent head 7b32c98. Consider uploading reports for the commit 7b32c98 to get more accurate results

@@            Coverage Diff             @@
##           master    #4575      +/-   ##
==========================================
- Coverage   83.35%   83.35%   -0.01%     
==========================================
  Files         409      410       +1     
  Lines       68548    68542       -6     
==========================================
- Hits        57140    57130      -10     
- Misses      11408    11412       +4     
Impacted Files Coverage Δ
src/modules/job-list/job-list.c 79.74% <ø> (ø)
src/modules/job-list/job_util.c 92.80% <ø> (ø)
src/modules/job-list/list.c 70.48% <ø> (ø)
src/modules/job-list/stats.c 75.00% <ø> (ø)
src/modules/job-list/job_state.c 72.33% <75.00%> (-1.23%) ⬇️
src/modules/job-list/job_data.c 80.72% <80.72%> (ø)
src/common/libpmi/simple_client.c 85.38% <0.00%> (-1.83%) ⬇️
src/common/libpmi/pmi2.c 88.60% <0.00%> (-1.27%) ⬇️
src/cmd/builtin/shutdown.c 86.91% <0.00%> (-0.94%) ⬇️
src/common/libsubprocess/server.c 60.54% <0.00%> (-0.55%) ⬇️
... and 6 more

@mergify mergify bot merged commit 8b5c558 into flux-framework:master Sep 20, 2022
@chu11 chu11 deleted the job_list_refactor branch September 20, 2022 19:38
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