Skip to content

Commit

Permalink
Merge pull request #489 from cmoussa1/rm.username.from.init
Browse files Browse the repository at this point in the history
JobRecord: remove `username` from `__init__()` of JobRecord object
  • Loading branch information
mergify[bot] authored Sep 16, 2024
2 parents 309afff + 401178d commit a3a9038
Showing 1 changed file with 10 additions and 13 deletions.
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

0 comments on commit a3a9038

Please sign in to comment.