-
Notifications
You must be signed in to change notification settings - Fork 80
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
Resource allocation colormap #3453
Open
Gossty
wants to merge
15
commits into
qiita-spots:dev
Choose a base branch
from
Gossty:resource-allocation-colormap
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+210
−133
Open
Changes from 10 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
88dc031
Update to DB qiita.slurm_resource_allocations
Gossty 447e01a
Merge branch 'dev' of https://github.com/qiita-spots/qiita into dev
Gossty 442e735
Merge branch 'dev' of https://github.com/qiita-spots/qiita into dev
Gossty 43aa8bf
Merge branch 'dev' of https://github.com/qiita-spots/qiita into dev
Gossty 3afba3a
Merge branch 'dev' of https://github.com/qiita-spots/qiita into dev
Gossty a36dc8a
Merge branch 'dev' of https://github.com/qiita-spots/qiita into dev
Gossty 071eb5f
Merge branch 'dev' of https://github.com/qiita-spots/qiita into dev
Gossty 2ecfa1e
Merge branch 'dev' of https://github.com/qiita-spots/qiita into dev
Gossty d5996f1
added colormap, create equation table
Gossty dd12143
Fixed styling
Gossty 1c30fc8
Using qiita.allocation_equations table in util.py
Gossty 82c95e1
Debug
Gossty 2cb3f37
Updates to @antgonza comments
Gossty 2ea03e2
Changes to @antgonza comments
Gossty 60ec9fd
Back to np.log
Gossty File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,72 @@ | ||
import pandas as pd | ||
|
||
# Example data loading | ||
filename = './data/jobs_2024-02-21.tsv.gz' | ||
df = pd.read_csv(filename, sep='\t', dtype={'extra_info': str}) | ||
|
||
# Convert string to timedelta, then to total seconds | ||
df['ElapsedRawTime'] = pd.to_timedelta( | ||
df['ElapsedRawTime']).apply( | ||
lambda x: x.total_seconds()) | ||
|
||
cname = "Validate" | ||
sname = "Diversity types - alpha_vector" | ||
df = df[(df.cName == cname) & (df.sName == sname)] | ||
|
||
df['samples'] = df['samples'].fillna(0).astype(int) | ||
df['columns'] = df['columns'].fillna(0).astype(int) | ||
df['input_size'] = df['input_size'].fillna(0).astype(int) | ||
df['MaxRSSRaw'] = df['MaxRSSRaw'].fillna(0).astype(int) | ||
df['ElapsedRawTime'] = df['ElapsedRawTime'].fillna(0).astype(int) | ||
|
||
COL_NAME = 'samples * columns' | ||
df[COL_NAME] = df['samples'] * df['columns'] | ||
columns = ["MaxRSSRaw", "ElapsedRawTime"] | ||
max_rows = [] | ||
|
||
for curr in columns: | ||
# Get the maximum value for 'curr' within each COL_NAME group | ||
max_values = df.groupby(COL_NAME)[curr].transform(max) | ||
# Filter rows where the current column's value | ||
# is the maximum within its group | ||
curr_rows = df[df[curr] == max_values] | ||
max_rows.append(curr_rows) | ||
|
||
filtered_df = pd.concat(max_rows).drop_duplicates().reset_index(drop=True) | ||
|
||
# INSERT INTO qiita.processing_job(processing_job_id, email, command_id, | ||
# command_parameters, processing_job_status_id) | ||
# VALUES('ca27ddbc-a678-4b09-8a1d-b65f52f8eb49', | ||
# '[email protected]', 1, '""'::json, 1); | ||
|
||
# INSERT INTO qiita.slurm_resource_allocations(processing_job_id, samples, | ||
# columns, input_size, extra_info, memory_used, walltime_used) | ||
# VALUES('ca27ddbc-a678-4b09-8a1d-b65f52f8eb49', 39, 81, 2, 'nan', | ||
# 327036000, 91); | ||
|
||
# processing_job_id uuid NOT NULL, | ||
# samples integer, | ||
# columns integer, | ||
# input_size bigint, | ||
# extra_info varchar DEFAULT NULL, | ||
# memory_used bigint, | ||
# walltime_used integer, | ||
|
||
res = "" | ||
|
||
for index, row in filtered_df.iterrows(): | ||
res += f"""('{row['QiitaID']}', '[email protected]', 1, '""'::json, 1),\n""" | ||
res += ";\n" | ||
res += "Split\n" | ||
for index, row in filtered_df.iterrows(): | ||
res += ( | ||
f"('{row['QiitaID']}', {int(row['samples'])}, " | ||
f"{int(row['columns'])}, {int(row['input_size'])}, " | ||
f"'{row['extra_info']}', {int(row['MaxRSSRaw'])}, " | ||
f"{int(row['ElapsedRawTime'])}),\n" | ||
) | ||
|
||
res += ";\n" | ||
|
||
with open("sql.txt", 'w') as filename: | ||
filename.write(res) |
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 |
---|---|---|
|
@@ -62,3 +62,11 @@ CREATE INDEX IF NOT EXISTS processing_job_command_parameters_payload ON qiita.pr | |
-- Addding contraints for the slurm_reservation column | ||
ALTER TABLE qiita.analysis DROP CONSTRAINT IF EXISTS analysis_slurm_reservation_valid_chars; | ||
ALTER TABLE qiita.analysis ADD CONSTRAINT analysis_slurm_reservation_valid_chars CHECK ( slurm_reservation ~ '^[a-zA-Z0-9_]*$' ); | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note that we did a release this morning so these lines need to be moved to 94.sql. |
||
-- Jan 7, 2025 | ||
-- Adding a table for formulas for resource allocations | ||
CREATE TABLE qiita.allocation_equations ( | ||
equation_id SERIAL PRIMARY KEY, | ||
equation_name TEXT NOT NULL, | ||
expression TEXT NOT NULL | ||
); |
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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need this file? Can it be deleted?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can delete this file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, thank you; then please rm.