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

Fix a few async-related bugs with archive jobs #38

Merged
merged 7 commits into from
Feb 20, 2025
Merged

Fix a few async-related bugs with archive jobs #38

merged 7 commits into from
Feb 20, 2025

Conversation

araglu
Copy link
Collaborator

@araglu araglu commented Feb 14, 2025

  • Move ensure_connected decorator to _update_status() which avoids connecting to HPCs for every update, even the ones that didn't need it like Completed status.
  • Change archive_dir from property to an async function.
  • Avoids this error: jobs_table:287 update_row(): You cannot call this from an async context.
  • Avoids this error when restoring an archived job: jobs_table:108 perform_action(): You cannot call this from an async context. It also failed to add the restored job back to the main jobs table.
  • Move database_sync_to_async from a decorator on instance_from_pbs_job() over to a function inside async areas. This change allows for calls to instance_from_pbs_job() from sync functions.
  • I think @sdc50 already fixed the missing commands variable, but it is fixed here as well.
  • Sets the job status from Complete to COM on the restored job. Without that, it kept appearing as a Pending job.

I'm not sure if these fixes are the best approach with async code. If the change to the decorator on instance_from_pbs_job() goes through, I also have to change one reference to it in another repo (load_previous_jobs).

CHW-673

update_status() usually avoids HPC calls because the job's status is
already Completed.
Before this, something would have needed to pre-fetch $ARCHIVE_HOME.
# Conflicts:
#	uit_plus_job/models.py
This moves the database_sync_to_async decorator to only the async code that calls instance_from_pbs_job.
This also changes .status to ._status because it kept appearing as a Pending job.
@araglu araglu requested a review from sdc50 February 14, 2025 23:03
@sdc50 sdc50 merged commit 67043a8 into main Feb 20, 2025
2 checks passed
@araglu araglu deleted the archive-async branch February 24, 2025 16:46
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