Skip to content

Commit

Permalink
fix quota records operation bug
Browse files Browse the repository at this point in the history
  • Loading branch information
kerrychu committed Jan 23, 2024
1 parent 562c7f4 commit 1252e17
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
4 changes: 1 addition & 3 deletions quota_limit.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ def monitor():
for project_id in PROJECT_IDs:
raw_quota = get_fileset_quota(project_id)
quota_record = stdout_to_quota_records(raw_quota)
file_set = {"FileSet": project_id}
data = {**file_set, **quota_record}
send_slack_message(data=data, webhook=SLACK_WEBHOOK)
send_slack_message(data=quota_record, webhook=SLACK_WEBHOOK)


if __name__ == "__main__":
Expand Down
4 changes: 2 additions & 2 deletions utils/subprocess_operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ def stdout_to_job_records(s: str) -> JOB_RECORDS:
def stdout_to_quota_records(s: str) -> QUOTA_RECORD:
s = s.strip()
s_list = s.split()
headers = ["Used Storage (GB)", "Storage Limit (GB)", "Current File Number", "File Number Limit"]
headers = ["FileSet", "Used Storage (GB)", "Storage Limit (GB)", "Current File Number", "File Number Limit"]
quota_record = {}
assert len(s_list) == len(
headers), f"unexpected error: quota size different from headers size. quota: {s_list}, headers: {headers}"
for header, quota in zip_longest(headers, s_list[1:]):
for header, quota in zip(headers, s_list):
quota_record[header] = quota
return quota_record

0 comments on commit 1252e17

Please sign in to comment.