-
Notifications
You must be signed in to change notification settings - Fork 357
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
27 changed files
with
322 additions
and
70 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 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
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
8 changes: 8 additions & 0 deletions
8
master/static/migrations/20221206103738_add-checkpoint-to-experiment.tx.down.sql
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,8 @@ | ||
ALTER TABLE experiments | ||
DROP COLUMN checkpoint_size; | ||
ALTER TABLE experiments | ||
DROP COLUMN checkpoint_count; | ||
ALTER TABLE trials | ||
DROP COLUMN checkpoint_size; | ||
ALTER TABLE trials | ||
DROP COLUMN checkpoint_count; |
23 changes: 23 additions & 0 deletions
23
master/static/migrations/20221206103738_add-checkpoint-to-experiment.tx.up.sql
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 @@ | ||
ALTER TABLE experiments | ||
ADD COLUMN checkpoint_size bigint; | ||
ALTER TABLE experiments | ||
ADD COLUMN checkpoint_count int; | ||
ALTER TABLE trials | ||
ADD COLUMN checkpoint_size bigint; | ||
ALTER TABLE trials | ||
ADD COLUMN checkpoint_count int; | ||
|
||
UPDATE trials set (checkpoint_size, checkpoint_count) = (size, count) FROM ( | ||
SELECT coalesce(sum((size_tuple).value::text::bigint), 0) AS size, count(distinct(uuid)) AS count, trial_id | ||
FROM ( | ||
SELECT jsonb_each(c.resources) AS size_tuple, trial_id, uuid | ||
FROM checkpoints_view c | ||
WHERE state != 'DELETED' | ||
AND c.resources != 'null'::jsonb ) r GROUP BY trial_id | ||
) s RIGHT JOIN (SELECT id FROM trials) t ON id = trial_id WHERE | ||
t.id = trials.id; | ||
|
||
UPDATE experiments set (checkpoint_size, checkpoint_count) = (size, count) FROM ( | ||
SELECT coalesce(sum(checkpoint_size), 0) AS size, coalesce(sum(checkpoint_count), 0) AS count, experiment_id | ||
FROM trials GROUP BY experiment_id | ||
) t WHERE experiments.id = experiment_id; |
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
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.