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

WIP: Update dispatchQuery to use min_cores #788

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,23 @@ public class DispatchQuery {

public static final String FIND_JOBS_BY_SHOW =
"/* FIND_JOBS_BY_SHOW */ " +
"SELECT pk_job, int_priority, rank FROM ( " +
"SELECT pk_job, int_priority, rank FROM ( " +
"SELECT " +
"ROW_NUMBER() OVER (ORDER BY job_resource.int_priority DESC) AS rank, " +
"job.pk_job, " +
"job_resource.int_priority " +
"ROW_NUMBER() OVER (ORDER BY int_priority DESC) AS rank, " +
"pk_job, " +
"int_priority " +
"FROM ( " +
"SELECT " +
"job.pk_job as pk_job, " +
"/* sort = priority + (100 * (1 - (job.cores/job.int_min_cores))) + (age in days) */ " +
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can this line be removed? Or maybe, if it's meant to explain the following code, make it a bit more clear that it's a comment.

"CAST( " +
"job_resource.int_priority + ( " +
"100 * (CASE WHEN job_resource.int_min_cores <= 0 THEN 0 " +
"ELSE 1 - job_resource.int_cores/job_resource.int_min_cores " +
"END) " +
") + ( " +
"(DATE_PART('days', NOW()) - DATE_PART('days', job.ts_updated)) " +
") as INT) as int_priority " +
"FROM " +
"job , " +
"job_resource , " +
Expand All @@ -50,7 +62,7 @@ public class DispatchQuery {
"(" +
"folder_resource.int_max_cores = -1 " +
"OR " +
"folder_resource.int_cores < folder_resource.int_max_cores " +
"folder_resource.int_cores + layer.int_cores_min < folder_resource.int_max_cores " +
") " +
"AND job.str_state = 'PENDING' " +
"AND job.b_paused = false " +
Expand Down Expand Up @@ -91,7 +103,7 @@ public class DispatchQuery {
"sum_running.int_sum_running < limit_record.int_max_value " +
"OR sum_running.int_sum_running IS NULL " +
") " +
") AS t1 WHERE rank < ?";
") AS t1 ) AS t2 WHERE rank < ?";


public static final String FIND_JOBS_BY_GROUP =
Expand Down