-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from converged-computing/add-unschedulable
add unschedulable status
- Loading branch information
Showing
22 changed files
with
487 additions
and
175 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
apiVersion: batch/v1 | ||
kind: Job | ||
metadata: | ||
name: job | ||
spec: | ||
completions: 10 | ||
parallelism: 10 | ||
template: | ||
metadata: | ||
labels: | ||
fluxnetes.group-name: job | ||
fluxnetes.group-size: "10" | ||
spec: | ||
schedulerName: fluxnetes | ||
containers: | ||
- name: job | ||
image: busybox | ||
command: [echo, potato] | ||
resources: | ||
requests: | ||
cpu: 20 | ||
restartPolicy: Never | ||
backoffLimit: 4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,45 @@ | ||
package queries | ||
|
||
// Queries used by the main queue (and shared across strategies sometimes) | ||
const ( | ||
GetTimestampQuery = "select created_at from pods_provisional where group_name=$1 limit 1" | ||
GetPodQuery = "select * from pods_provisional where group_name=$1 and namespace=$2 and name=$3" | ||
InsertPodQuery = "insert into pods_provisional (podspec, namespace, name, duration, created_at, group_name, group_size) values ($1, $2, $3, $4, $5, $6, $7)" | ||
CountPodsQuery = "select count(*) from pods_provisional where group_name=$1" | ||
UpdateNodesQuery = "update river_job set args = jsonb_set(args, '{nodes}', to_jsonb($1::text)) where id=$2;" | ||
// Used to get the earliest timstamp for the group | ||
GetTimestampQuery = "select created_at from pods_provisional where group_name=$1 and namespace=$2 limit 1;" | ||
|
||
// When we complete a job worker type after a successful MatchAllocate, this is how we send nodes back via an event | ||
UpdateNodesQuery = "update river_job set args = jsonb_set(args, '{nodes}', to_jsonb($1::text)) where id=$2;" | ||
|
||
// Reservations | ||
AddReservationQuery = "insert into reservations (group_name, flux_id) values ($1, $2);" | ||
DeleteReservationsQuery = "truncate reservations; delete from reservations;" | ||
GetReservationsQuery = "select (group_name, flux_id) from reservations;" | ||
|
||
// This query should achieve the following (but does not work) | ||
// This query should achieve the following | ||
// 1. Select groups for which the size >= the number of pods we've seen | ||
// 2. Then get the group_name, group_size, and podspec for each (this goes to scheduler) | ||
// Ensures we are sorting by the timestamp when they were added (should be DESC I think) | ||
RefreshGroupsQuery = "refresh materialized view groups_size;" | ||
SelectGroupsReadyQuery = "select * from pods_provisional join groups_size on pods_provisional.group_name = groups_size.group_name where group_size >= count order by created_at desc;" | ||
// 2. Then get a representative pod to model the resources for the group | ||
// TODO add back created by and then sort by it desc | ||
SelectGroupsAtSizeQuery = "select group_name, group_size, duration, podspec, namespace from groups_provisional where current_size >= group_size;" | ||
SelectRepresentativePodQuery = `select podspec from pods_provisional where group_name = $1 and namespace = $2;` | ||
|
||
// Pending queue - inserted after moving from provisional | ||
InsertIntoPending = "insert into pending_queue (group_name, namespace, group_size) SELECT '%s', '%s', '%d' WHERE NOT EXISTS (SELECT (group_name, namespace) FROM pending_queue WHERE group_name = '%s' and namespace = '%s');" | ||
|
||
// We delete from the provisional tables when a group is added to the work queues (and pending queue, above) | ||
DeleteProvisionalGroupsQuery = "delete from groups_provisional where %s;" | ||
DeleteGroupsQuery = "delete from pods_provisional where %s;" | ||
|
||
// TODO add created_at back | ||
InsertIntoProvisionalQuery = "insert into pods_provisional (podspec, namespace, name, duration, group_name) select '%s', '%s', '%s', %d, '%s' where not exists (select (group_name, name, namespace) from pods_provisional where group_name = '%s' and namespace = '%s' and name = '%s');" | ||
|
||
// Enqueue queries | ||
// 1. Single pods are added to the pods_provisional - this is how we track uniqueness (and eventually will grab all podspecs from here) | ||
// 2. Groups are added to the groups_provisional, and this is where we can easily store a current cound | ||
// Note that we add a current_size of 1 here assuming the first creation is done paired with an existing pod (and then don't need to increment again) | ||
InsertIntoGroupProvisional = "insert into groups_provisional (group_name, namespace, group_size, duration, podspec, current_size) select '%s', '%s', '%d', '%d', '%s', '1' WHERE NOT EXISTS (SELECT (group_name, namespace) FROM groups_provisional WHERE group_name = '%s' and namespace = '%s');" | ||
IncrementGroupProvisional = "update groups_provisional set current_size = current_size + 1 where group_name = '%s' and namespace = '%s';" | ||
|
||
// 3. Then delete all from the table | ||
DeleteGroupsQuery = "delete from pods_provisional where group_name in ('%s');" | ||
// Pending Queue queries | ||
// 3. We always check if a group is in pending before Enqueue, because if so, we aren't allowed to modify / add to the group | ||
IsPendingQuery = "select * from pending_queue where group_name = $1 and namespace = $2;" | ||
|
||
// Note that is used to be done with two queries - these are no longer used | ||
SelectGroupsAtSizeQuery = "select group_name from pods_provisional group by group_name, group_size, created_at having group_size >= count(*) order by created_at desc;" | ||
SelectGroupsQuery = "select group_name, group_size, podspec, duration from pods_provisional where group_name in ('%s');" | ||
// We remove from pending to allow another group submission of the same name on cleanup | ||
DeleteFromPendingQuery = "delete from pending_queue where group_name=$1 and namespace=$2;" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.