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

JobRecord: remove username from __init__() of JobRecord object #489

Merged
merged 2 commits into from
Sep 16, 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
23 changes: 10 additions & 13 deletions src/bindings/python/fluxacct/accounting/jobs_table_subcommands.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,7 @@ class JobRecord:
A record of an individual job.
"""

def __init__(
self, userid, _username, jobid, t_submit, t_run, t_inactive, nnodes, resources
):
def __init__(self, userid, jobid, t_submit, t_run, t_inactive, nnodes, resources):
self.userid = userid
self.username = get_username(userid)
self.jobid = jobid
Expand Down Expand Up @@ -132,20 +130,19 @@ def convert_to_obj(rows):
try:
# attempt to create a ResourceSet from R
rset = ResourceSet(row[6])
nnodes = rset.nnodes
job_nnodes = rset.nnodes
except (ValueError, TypeError):
# can't convert R to a ResourceSet object; skip it
continue

job_record = JobRecord(
row[0], # userid
get_username(row[0]), # username
row[1], # jobid
row[2], # t_submit
row[3], # t_run
row[4], # t_inactive
nnodes, # nnodes
row[6], # resources
userid=row[0],
jobid=row[1],
t_submit=row[2],
t_run=row[3],
t_inactive=row[4],
nnodes=job_nnodes,
resources=row[6],
)
job_records.append(job_record)

Expand Down Expand Up @@ -212,7 +209,7 @@ def get_jobs(conn, **kwargs):
- jobid

The function will execute a SQL query and return a list of jobs. If no
jobs are fuond, an empty list is returned.
jobs are found, an empty list is returned.
"""
# find out which args were passed and place them in a dict
valid_params = {"user", "after_start_time", "before_end_time", "jobid"}
Expand Down
Loading