Skip to content

Commit

Permalink
updated hysds mozart util
Browse files Browse the repository at this point in the history
  • Loading branch information
marjo-luc committed Jul 24, 2024
1 parent 31b3910 commit 911cf71
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
9 changes: 5 additions & 4 deletions api/endpoints/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -504,15 +504,16 @@ def get(self, username):

# Get params and set default values
params = {key: request.args.get(key, default) for key, default in defaults.items()}

# Filter out params that are not needed for the mozart request
filtered_query_params = {k: v for k, v in params.items() if k != 'get_job_details' and v is not None}

# Filter out params that are not needed
exclude_list = ["username", "get_job_details"]
filtered_query_params = {k: v for k, v in params.items() if k not in exclude_list and v is not None}

try:
logging.info("Finding jobs for user: {}".format(username))

# Get list of jobs ids for the user
response = hysds.get_mozart_jobs(**filtered_query_params)
response = hysds.get_mozart_jobs(username, filtered_query_params)
job_list = response.get("result")
logging.info("Found Jobs: {}".format(job_list))

Expand Down
6 changes: 3 additions & 3 deletions api/utils/hysds_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,7 @@ def get_mozart_queues():
raise Exception("Couldn't get list of available queues")


def get_mozart_jobs(username, page_size=10, offset=0):
def get_mozart_jobs(username, **kwargs):
"""
Returns mozart's job list
:param username:
Expand All @@ -633,8 +633,8 @@ def get_mozart_jobs(username, page_size=10, offset=0):
:return:
"""
params = dict()
params["page_size"] = page_size
params["offset"] = offset # this is specifies the offset
for key, value in kwargs.items():
params[key] = value

session = requests.Session()
session.verify = False
Expand Down

0 comments on commit 911cf71

Please sign in to comment.