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

replace production tpv api call with database query #1978

Conversation

cat-bro
Copy link
Collaborator

@cat-bro cat-bro commented May 28, 2024

This replaces the TPV's API call to the stats server with a database query. Destinations are still being ranked by the metric of %cpu used and future changes will consider memory as well. The result will be different because a job is counted in the query as soon as it has been queued, rather than as soon as it is running at the destination.

This is the first step in updating the ranking and we can observe whether it significantly increases the load on the database. Further changes will involve considering memory, and considering the quantity of resources available at various destinations instead of the proportion. I'd like to address the edge cases of low CPU high memory jobs that sometimes get stuck in the slurm queue when better destinations are immediately available.

Partly addresses issue #1142

This is ready to go but I've marked it as WIP - if merged I'd like to be around in case it throws exceptions.

from (
select id,
CAST((REGEXP_MATCHES(encode(destination_params, 'escape'),'ntasks=(\d+)'))[1] as INTEGER) as cores,
CAST((REGEXP_MATCHES(encode(destination_params, 'escape'),'mem=(\d+)'))[1] as INTEGER) as mem,
Copy link
Contributor

Choose a reason for hiding this comment

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

We should be able to avoid the regex if we merge this: galaxyproject/tpv-shared-database#61

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

eventually yes, there should be a more pleasant query, even one that can be expressed in sqlalchemy. For now, this works

@cat-bro cat-bro changed the title [WIP] replace production tpv api call with database query replace production tpv api call with database query May 29, 2024
@cat-bro cat-bro requested a review from jlqfab May 29, 2024 05:38
@cat-bro cat-bro merged commit df45620 into usegalaxy-au:master May 29, 2024
1 check passed
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.

3 participants