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

Refactor Job manager routes #296

Draft
wants to merge 17 commits into
base: main
Choose a base branch
from
Draft

Conversation

ryuwd
Copy link

@ryuwd ryuwd commented Sep 16, 2024

  • Renamed from job_manager to jobs
  • Split into multiple modules
  • Removed some endpoints in favour of expressing the desired operation(s) as single or bulk job status changes
  • Used TaskGroup or ForgivingTaskGroup over asyncio.gather, etc where appropriate
  • Major refactor of reschedule_job to respect the job state machine
  • Additionally try to reduce the number of statements/queries generated in bulk operations

For #22
Needs DIRACGrid/DIRAC#7794

TODO:

  • Tests passing
  • Check rescheduling and resetJob
  • fix bug in job state machine when rescheduling in JobDB
  • make rescheduling and reset job tests a bit more rigorous to check I did not break anything
  • regenerate client methods with autorest
  • use config object to pull out MaxRescheduling from the CS instead of making a property in JobDB

@fstagni fstagni linked an issue Sep 17, 2024 that may be closed by this pull request
8 tasks
@ryuwd ryuwd mentioned this pull request Sep 18, 2024
@ryuwd
Copy link
Author

ryuwd commented Sep 23, 2024

65da423 is the start of using bulk insert/update statements in the job manager, and are supposed to be significantly faster than lots of single insert/update statements. I started with rescheduling and job status updates.


# Update JDL (Should we be doing this here?)
result = await job_db.setJobJDL(job_id, jobJDL)
# DATABASE OPERATION
await job_db.setJobJDLsBulk(jdl_changes)
Copy link
Author

Choose a reason for hiding this comment

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

I should check which rows were successfully updated in the previous operation and exclude unsuccessful updates from the JDL update statement.

@ryuwd
Copy link
Author

ryuwd commented Sep 23, 2024

@fstagni do you have any view on things to watch out for with bulk inserts and updates, based on previous experience in DIRAC? I can foresee some risks of things becoming inconsistent, which could be mitigated by reducing the batch sizes or carefully checking the input and results of each statement execution.

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.

JobManagerHandler conversion
2 participants