Skip to content
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

made app stats more robust because of malformed EE2 records with miss… #123

Merged
merged 1 commit into from
Nov 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 30 additions & 15 deletions source/daily_cron_jobs/methods_upload_app_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ def get_user_app_stats(
no_queued_counter = 0
has_requirements_counter = 0
no_job_input_counter = 0
missing_app_id_dict = dict()
missing_app_id_count = 0

for job in stats["jobs"]:
if job["status"] in statuses or "finished" not in job:
continue
Expand Down Expand Up @@ -108,25 +111,37 @@ def get_user_app_stats(
# print("JOB ID : " + str(job["job_id"]) + " has no job_input ")
# print(str(job))
# exit()
job_stats = {
"job_id": job["job_id"],
"user": job["user"],
"finish_date": finished.strftime("%Y-%m-%d %H:%M:%S"),
"start_date": run_start.strftime("%Y-%m-%d %H:%M:%S"),
"run_time": run_time,
"app_name": job["job_input"]["app_id"].replace(".", "/"),
"func_name": job["job_input"]["method"].replace(".", "/"),
"git_commit_hash": job["job_input"]["service_ver"],
"is_error": is_error,
"ws_id": ws_id,
"queue_time": queue_time,
"reserved_cpu": reserved_cpu,
}
job_array.append(job_stats)
app_name = None
if "app_id" not in job["job_input"]:
missing_app_id_count += 1
if job["user"] not in missing_app_id_dict:
missing_app_id_dict[job["user"]] = set()
missing_app_id_dict[job["user"]].add(job["job_id"])

else:
#record has app_id proceed as normal
job_stats = {
"job_id": job["job_id"],
"user": job["user"],
"finish_date": finished.strftime("%Y-%m-%d %H:%M:%S"),
"start_date": run_start.strftime("%Y-%m-%d %H:%M:%S"),
"run_time": run_time,
"app_name": job["job_input"]["app_id"].replace(".", "/"),
"func_name": job["job_input"]["method"].replace(".", "/"),
"git_commit_hash": job["job_input"]["service_ver"],
"is_error": is_error,
"ws_id": ws_id,
"queue_time": queue_time,
"reserved_cpu": reserved_cpu,
}
job_array.append(job_stats)
print("HAS QUEUED Count: " + str(has_queued_counter))
print("NO QUEUED Count: " + str(no_queued_counter))
print("HAS REQUIREMENTS Count: " + str(has_requirements_counter))
print("NO JOB INPUT COUNT: " + str(no_job_input_counter))
print("NO APP ID COUNT: " + str(missing_app_id_count))
if missing_app_id_count > 0:
print("DETAILED NO APP ID DICT : " + str(missing_app_id_dict))
return job_array


Expand Down
Loading