cybergis / cybergis-compute-python-sdk

https://cybergis.github.io/cybergis-compute-python-sdk
Apache License 2.0
5 stars 7 forks source link

[Bug] list_job() broken #50

Closed alexandermichels closed 2 years ago

alexandermichels commented 2 years ago

The list_job() function seems to be broken. To replicate, run a job and then run:

cybergis.list_job()

Seems like a straightforward issue though, it throws an error if the remoteExecutableFolder is None. I've attached a screenshot and copy/paste of the error below:

Screenshot: Screenshot from 2022-09-03 15-27-39

Copy/Paste:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Input In [9], in <cell line: 1>()
----> 1 cybergis.list_job()

File /data/cigi/cybergisx-easybuild/conda/python3-0.9.0/lib/python3.8/site-packages/cybergis_compute_client/CyberGISCompute.py:277, in CyberGISCompute.list_job(self, raw)
    271 data = []
    272 for job in jobs['job']:
    273     data.append([
    274         job['id'],
    275         job['hpc'],
    276         job['remoteExecutableFolder']["id"] if (
--> 277             "id" in job['remoteExecutableFolder']) else None,
    278         job['remoteDataFolder']["id"] if (
    279             "id" in job['remoteDataFolder']) else None,
    280         job['remoteResultFolder']["id"] if (
    281             "id" in job['remoteResultFolder']) else None,
    282         job['remoteDataFolder'],
    283         job['remoteResultFolder'],
    284         json.dumps(job['param']),
    285         json.dumps(job['slurm']),
    286         job['userId'],
    287         job['maintainer'],
    288         job['createdAt'],
    289     ])
    291 if self.isJupyter:
    292     if len(data) == 0:

TypeError: argument of type 'NoneType' is not iterable