-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9b6db46
commit ba2f406
Showing
3 changed files
with
32 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
ALTER TABLE job DROP energy; | ||
ALTER TABLE job DROP energy_footprint; | ||
ALTER TABLE job ADD COLUMN flops_any_avg; | ||
ALTER TABLE job ADD COLUMN mem_bw_avg; | ||
ALTER TABLE job ADD COLUMN mem_used_max; | ||
ALTER TABLE job ADD COLUMN load_avg; | ||
ALTER TABLE job ADD COLUMN net_bw_avg; | ||
ALTER TABLE job ADD COLUMN net_data_vol_total; | ||
ALTER TABLE job ADD COLUMN file_bw_avg; | ||
ALTER TABLE job ADD COLUMN file_data_vol_total; | ||
|
||
UPDATE job SET flops_any_avg = json_extract(footprint, '$.flops_any_avg'); | ||
UPDATE job SET mem_bw_avg = json_extract(footprint, '$.mem_bw_avg'); | ||
UPDATE job SET mem_used_max = json_extract(footprint, '$.mem_used_max'); | ||
UPDATE job SET load_avg = json_extract(footprint, '$.cpu_load_avg'); | ||
UPDATE job SET net_bw_avg = json_extract(footprint, '$.net_bw_avg'); | ||
UPDATE job SET net_data_vol_total = json_extract(footprint, '$.net_data_vol_total'); | ||
UPDATE job SET file_bw_avg = json_extract(footprint, '$.file_bw_avg'); | ||
UPDATE job SET file_data_vol_total = json_extract(footprint, '$.file_data_vol_total'); | ||
|
||
ALTER TABLE job DROP footprint; |
10 changes: 10 additions & 0 deletions
10
internal/repository/migrations/sqlite3/08_add-footprint.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 |
---|---|---|
@@ -1,12 +1,22 @@ | ||
ALTER TABLE job ADD COLUMN energy REAL NOT NULL DEFAULT 0.0; | ||
ALTER TABLE job ADD COLUMN energy_footprint TEXT DEFAULT NULL; | ||
|
||
ALTER TABLE job ADD COLUMN footprint TEXT DEFAULT NULL; | ||
UPDATE job SET footprint = '{"flops_any_avg": 0.0}'; | ||
UPDATE job SET footprint = json_replace(footprint, '$.flops_any_avg', job.flops_any_avg); | ||
UPDATE job SET footprint = json_insert(footprint, '$.mem_bw_avg', job.mem_bw_avg); | ||
UPDATE job SET footprint = json_insert(footprint, '$.mem_used_max', job.mem_used_max); | ||
UPDATE job SET footprint = json_insert(footprint, '$.cpu_load_avg', job.load_avg); | ||
UPDATE job SET footprint = json_insert(footprint, '$.net_bw_avg', job.net_bw_avg); | ||
UPDATE job SET footprint = json_insert(footprint, '$.net_data_vol_total', job.net_data_vol_total); | ||
UPDATE job SET footprint = json_insert(footprint, '$.file_bw_avg', job.file_bw_avg); | ||
UPDATE job SET footprint = json_insert(footprint, '$.file_data_vol_total', job.file_data_vol_total); | ||
|
||
ALTER TABLE job DROP flops_any_avg; | ||
ALTER TABLE job DROP mem_bw_avg; | ||
ALTER TABLE job DROP mem_used_max; | ||
ALTER TABLE job DROP load_avg; | ||
ALTER TABLE job DROP net_bw_avg; | ||
ALTER TABLE job DROP net_data_vol_total; | ||
ALTER TABLE job DROP file_bw_avg; | ||
ALTER TABLE job DROP file_data_vol_total; |
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