cloudos-cli 2.57.0__tar.gz → 2.58.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. {cloudos_cli-2.57.0 → cloudos_cli-2.58.0}/PKG-INFO +4 -10
  2. {cloudos_cli-2.57.0 → cloudos_cli-2.58.0}/README.md +3 -9
  3. {cloudos_cli-2.57.0 → cloudos_cli-2.58.0}/cloudos_cli/__main__.py +19 -2
  4. cloudos_cli-2.58.0/cloudos_cli/_version.py +1 -0
  5. {cloudos_cli-2.57.0 → cloudos_cli-2.58.0}/cloudos_cli/clos.py +63 -0
  6. {cloudos_cli-2.57.0 → cloudos_cli-2.58.0}/cloudos_cli.egg-info/PKG-INFO +4 -10
  7. cloudos_cli-2.57.0/cloudos_cli/_version.py +0 -1
  8. {cloudos_cli-2.57.0 → cloudos_cli-2.58.0}/LICENSE +0 -0
  9. {cloudos_cli-2.57.0 → cloudos_cli-2.58.0}/cloudos_cli/__init__.py +0 -0
  10. {cloudos_cli-2.57.0 → cloudos_cli-2.58.0}/cloudos_cli/configure/__init__.py +0 -0
  11. {cloudos_cli-2.57.0 → cloudos_cli-2.58.0}/cloudos_cli/configure/configure.py +0 -0
  12. {cloudos_cli-2.57.0 → cloudos_cli-2.58.0}/cloudos_cli/datasets/__init__.py +0 -0
  13. {cloudos_cli-2.57.0 → cloudos_cli-2.58.0}/cloudos_cli/datasets/datasets.py +0 -0
  14. {cloudos_cli-2.57.0 → cloudos_cli-2.58.0}/cloudos_cli/import_wf/__init__.py +0 -0
  15. {cloudos_cli-2.57.0 → cloudos_cli-2.58.0}/cloudos_cli/import_wf/import_wf.py +0 -0
  16. {cloudos_cli-2.57.0 → cloudos_cli-2.58.0}/cloudos_cli/jobs/__init__.py +0 -0
  17. {cloudos_cli-2.57.0 → cloudos_cli-2.58.0}/cloudos_cli/jobs/job.py +0 -0
  18. {cloudos_cli-2.57.0 → cloudos_cli-2.58.0}/cloudos_cli/link/__init__.py +0 -0
  19. {cloudos_cli-2.57.0 → cloudos_cli-2.58.0}/cloudos_cli/link/link.py +0 -0
  20. {cloudos_cli-2.57.0 → cloudos_cli-2.58.0}/cloudos_cli/procurement/__init__.py +0 -0
  21. {cloudos_cli-2.57.0 → cloudos_cli-2.58.0}/cloudos_cli/procurement/images.py +0 -0
  22. {cloudos_cli-2.57.0 → cloudos_cli-2.58.0}/cloudos_cli/queue/__init__.py +0 -0
  23. {cloudos_cli-2.57.0 → cloudos_cli-2.58.0}/cloudos_cli/queue/queue.py +0 -0
  24. {cloudos_cli-2.57.0 → cloudos_cli-2.58.0}/cloudos_cli/utils/__init__.py +0 -0
  25. {cloudos_cli-2.57.0 → cloudos_cli-2.58.0}/cloudos_cli/utils/array_job.py +0 -0
  26. {cloudos_cli-2.57.0 → cloudos_cli-2.58.0}/cloudos_cli/utils/cloud.py +0 -0
  27. {cloudos_cli-2.57.0 → cloudos_cli-2.58.0}/cloudos_cli/utils/details.py +0 -0
  28. {cloudos_cli-2.57.0 → cloudos_cli-2.58.0}/cloudos_cli/utils/errors.py +0 -0
  29. {cloudos_cli-2.57.0 → cloudos_cli-2.58.0}/cloudos_cli/utils/last_wf.py +0 -0
  30. {cloudos_cli-2.57.0 → cloudos_cli-2.58.0}/cloudos_cli/utils/requests.py +0 -0
  31. {cloudos_cli-2.57.0 → cloudos_cli-2.58.0}/cloudos_cli/utils/resources.py +0 -0
  32. {cloudos_cli-2.57.0 → cloudos_cli-2.58.0}/cloudos_cli.egg-info/SOURCES.txt +0 -0
  33. {cloudos_cli-2.57.0 → cloudos_cli-2.58.0}/cloudos_cli.egg-info/dependency_links.txt +0 -0
  34. {cloudos_cli-2.57.0 → cloudos_cli-2.58.0}/cloudos_cli.egg-info/entry_points.txt +0 -0
  35. {cloudos_cli-2.57.0 → cloudos_cli-2.58.0}/cloudos_cli.egg-info/requires.txt +0 -0
  36. {cloudos_cli-2.57.0 → cloudos_cli-2.58.0}/cloudos_cli.egg-info/top_level.txt +0 -0
  37. {cloudos_cli-2.57.0 → cloudos_cli-2.58.0}/setup.cfg +0 -0
  38. {cloudos_cli-2.57.0 → cloudos_cli-2.58.0}/setup.py +0 -0
  39. {cloudos_cli-2.57.0 → cloudos_cli-2.58.0}/tests/__init__.py +0 -0
  40. {cloudos_cli-2.57.0 → cloudos_cli-2.58.0}/tests/functions_for_pytest.py +0 -0
  41. {cloudos_cli-2.57.0 → cloudos_cli-2.58.0}/tests/test_cli_project_create.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cloudos_cli
3
- Version: 2.57.0
3
+ Version: 2.58.0
4
4
  Summary: Python package for interacting with CloudOS
5
5
  Home-page: https://github.com/lifebit-ai/cloudos-cli
6
6
  Author: David Piñeyro
@@ -204,15 +204,7 @@ This will tell you the implemented commands. Each implemented command has its ow
204
204
  ```bash
205
205
  cloudos job list --help
206
206
  ```
207
- ```console
208
- CloudOS python package: a package for interacting with CloudOS.
209
-
210
- Version: 2.55.0
211
-
212
- CloudOS job functionality: run, check and abort jobs in CloudOS.
213
-
214
-
215
- Usage: cloudos job list [OPTIONS]
207
+ ```console Usage: cloudos job list [OPTIONS]
216
208
 
217
209
  Collect workspace jobs from a CloudOS workspace in CSV or JSON format.
218
210
 
@@ -249,6 +241,7 @@ CloudOS job functionality: run, check and abort jobs in CloudOS.
249
241
  │ --filter-queue TEXT Filter jobs by queue name. Only applies to jobs running │
250
242
  │ in batch environment. Non-batch jobs are preserved in │
251
243
  │ results. │
244
+ │ --filter-owner TEXT Filter jobs by owner username. │
252
245
  │ --verbose Whether to print information messages or not. │
253
246
  │ --disable-ssl-verification Disable SSL certificate verification. Please, remember │
254
247
  │ that this option is not generally recommended for │
@@ -926,6 +919,7 @@ You find specific jobs within your workspace using the listing filtering options
926
919
  - **`--filter-workflow`**: Filter jobs by workflow/pipeline name (exact match required)
927
920
  - **`--filter-job-id`**: Filter jobs by specific job ID (exact match required)
928
921
  - **`--filter-only-mine`**: Show only jobs belonging to the current user
922
+ - **`--filter-owner`**: Show only job for the specified owner (exact match required, i.e needs to be in quotes and be "Name Surname")
929
923
  - **`--filter-queue`**: Filter jobs by queue name (only applies to batch jobs)
930
924
 
931
925
  Here following are some examples:
@@ -169,15 +169,7 @@ This will tell you the implemented commands. Each implemented command has its ow
169
169
  ```bash
170
170
  cloudos job list --help
171
171
  ```
172
- ```console
173
- CloudOS python package: a package for interacting with CloudOS.
174
-
175
- Version: 2.55.0
176
-
177
- CloudOS job functionality: run, check and abort jobs in CloudOS.
178
-
179
-
180
- Usage: cloudos job list [OPTIONS]
172
+ ```console Usage: cloudos job list [OPTIONS]
181
173
 
182
174
  Collect workspace jobs from a CloudOS workspace in CSV or JSON format.
183
175
 
@@ -214,6 +206,7 @@ CloudOS job functionality: run, check and abort jobs in CloudOS.
214
206
  │ --filter-queue TEXT Filter jobs by queue name. Only applies to jobs running │
215
207
  │ in batch environment. Non-batch jobs are preserved in │
216
208
  │ results. │
209
+ │ --filter-owner TEXT Filter jobs by owner username. │
217
210
  │ --verbose Whether to print information messages or not. │
218
211
  │ --disable-ssl-verification Disable SSL certificate verification. Please, remember │
219
212
  │ that this option is not generally recommended for │
@@ -891,6 +884,7 @@ You find specific jobs within your workspace using the listing filtering options
891
884
  - **`--filter-workflow`**: Filter jobs by workflow/pipeline name (exact match required)
892
885
  - **`--filter-job-id`**: Filter jobs by specific job ID (exact match required)
893
886
  - **`--filter-only-mine`**: Show only jobs belonging to the current user
887
+ - **`--filter-owner`**: Show only job for the specified owner (exact match required, i.e needs to be in quotes and be "Name Surname")
894
888
  - **`--filter-queue`**: Filter jobs by queue name (only applies to batch jobs)
895
889
 
896
890
  Here following are some examples:
@@ -1326,6 +1326,8 @@ def job_details(ctx,
1326
1326
  is_flag=True)
1327
1327
  @click.option('--filter-queue',
1328
1328
  help='Filter jobs by queue name. Only applies to jobs running in batch environment. Non-batch jobs are preserved in results.')
1329
+ @click.option('--filter-owner',
1330
+ help='Filter jobs by owner username.')
1329
1331
  @click.option('--verbose',
1330
1332
  help='Whether to print information messages or not.',
1331
1333
  is_flag=True)
@@ -1354,7 +1356,7 @@ def list_jobs(ctx,
1354
1356
  last,
1355
1357
  filter_job_id,
1356
1358
  filter_only_mine,
1357
- #filter_owner,
1359
+ filter_owner,
1358
1360
  filter_queue,
1359
1361
  verbose,
1360
1362
  disable_ssl_verification,
@@ -1417,10 +1419,25 @@ def list_jobs(ctx,
1417
1419
  filter_workflow=filter_workflow,
1418
1420
  filter_job_id=filter_job_id,
1419
1421
  filter_only_mine=filter_only_mine,
1422
+ filter_owner=filter_owner,
1420
1423
  filter_queue=filter_queue,
1421
1424
  last=last)
1422
1425
  if len(my_jobs_r) == 0:
1423
- if ctx.get_parameter_source('page') == click.core.ParameterSource.DEFAULT:
1426
+ # Check if any filtering options are being used
1427
+ filters_used = any([
1428
+ filter_status,
1429
+ filter_job_name,
1430
+ filter_project,
1431
+ filter_workflow,
1432
+ filter_job_id,
1433
+ filter_only_mine,
1434
+ filter_owner,
1435
+ filter_queue
1436
+ ])
1437
+
1438
+ if filters_used:
1439
+ print('\t[Message] A total of 0 jobs collected.')
1440
+ elif ctx.get_parameter_source('page') == click.core.ParameterSource.DEFAULT:
1424
1441
  print('\t[Message] A total of 0 jobs collected. This is likely because your workspace ' +
1425
1442
  'has no jobs created yet.')
1426
1443
  else:
@@ -0,0 +1 @@
1
+ __version__ = '2.58.0'
@@ -420,6 +420,63 @@ class Cloudos:
420
420
  }
421
421
  return headers
422
422
 
423
+ def resolve_user_id(self, filter_owner, workspace_id, verify=True):
424
+ """Resolve a username or display name to a user ID.
425
+
426
+ Parameters
427
+ ----------
428
+ filter_owner : str
429
+ The username or display name to search for.
430
+ workspace_id : str
431
+ The CloudOS workspace ID.
432
+ verify : [bool|string]
433
+ Whether to use SSL verification or not. Alternatively, if
434
+ a string is passed, it will be interpreted as the path to
435
+ the SSL certificate file.
436
+
437
+ Returns
438
+ -------
439
+ str
440
+ The user ID corresponding to the filter_owner.
441
+
442
+ Raises
443
+ ------
444
+ ValueError
445
+ If the user cannot be found or if there's an error during the search.
446
+ """
447
+ try:
448
+ search_headers = {
449
+ "Content-type": "application/json",
450
+ "apikey": self.apikey
451
+ }
452
+ search_params = {
453
+ "q": filter_owner,
454
+ "teamId": workspace_id
455
+ }
456
+ # Note: this endpoint may not be open in all CloudOS instances
457
+ user_search_r = retry_requests_get(f"{self.cloudos_url}/api/v1/users/search-assist",
458
+ params=search_params, headers=search_headers, verify=verify)
459
+ if user_search_r.status_code >= 400:
460
+ raise ValueError(f"Error searching for user '{filter_owner}'")
461
+
462
+ user_search_content = user_search_r.json()
463
+ user_items = user_search_content.get('items', [])
464
+ if user_items and len(user_items) > 0:
465
+ user_match = None
466
+ for user in user_items:
467
+ if user.get("username") == filter_owner or user.get("name") == filter_owner:
468
+ user_match = user
469
+ break
470
+
471
+ if user_match:
472
+ return user_match.get("id")
473
+ else:
474
+ raise ValueError(f"User '{filter_owner}' not found.")
475
+ else:
476
+ raise ValueError(f"User '{filter_owner}' not found.")
477
+ except Exception as e:
478
+ raise ValueError(f"Error resolving user '{filter_owner}': {str(e)}")
479
+
423
480
  def get_cromwell_status(self, workspace_id, verify=True):
424
481
  """Get Cromwell server status from CloudOS.
425
482
 
@@ -511,6 +568,8 @@ class Cloudos:
511
568
  Filter jobs by specific job ID.
512
569
  filter_only_mine : bool, optional
513
570
  Filter to show only jobs belonging to the current user.
571
+ filter_owner : string, optional
572
+ Filter jobs by owner username (will be resolved to user ID).
514
573
  filter_queue : string, optional
515
574
  Filter jobs by queue name (will be resolved to queue ID).
516
575
  Only applies to jobs running in batch environment.
@@ -598,6 +657,10 @@ class Cloudos:
598
657
  except Exception as e:
599
658
  raise ValueError(f"Error getting current user info: {str(e)}")
600
659
 
660
+ # Resolve owner username to user ID
661
+ if filter_owner:
662
+ user_id = self.resolve_user_id(filter_owner, workspace_id, verify)
663
+ params["user.id"] = user_id
601
664
 
602
665
  # --- Fetch jobs page by page ---
603
666
  all_jobs = []
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cloudos_cli
3
- Version: 2.57.0
3
+ Version: 2.58.0
4
4
  Summary: Python package for interacting with CloudOS
5
5
  Home-page: https://github.com/lifebit-ai/cloudos-cli
6
6
  Author: David Piñeyro
@@ -204,15 +204,7 @@ This will tell you the implemented commands. Each implemented command has its ow
204
204
  ```bash
205
205
  cloudos job list --help
206
206
  ```
207
- ```console
208
- CloudOS python package: a package for interacting with CloudOS.
209
-
210
- Version: 2.55.0
211
-
212
- CloudOS job functionality: run, check and abort jobs in CloudOS.
213
-
214
-
215
- Usage: cloudos job list [OPTIONS]
207
+ ```console Usage: cloudos job list [OPTIONS]
216
208
 
217
209
  Collect workspace jobs from a CloudOS workspace in CSV or JSON format.
218
210
 
@@ -249,6 +241,7 @@ CloudOS job functionality: run, check and abort jobs in CloudOS.
249
241
  │ --filter-queue TEXT Filter jobs by queue name. Only applies to jobs running │
250
242
  │ in batch environment. Non-batch jobs are preserved in │
251
243
  │ results. │
244
+ │ --filter-owner TEXT Filter jobs by owner username. │
252
245
  │ --verbose Whether to print information messages or not. │
253
246
  │ --disable-ssl-verification Disable SSL certificate verification. Please, remember │
254
247
  │ that this option is not generally recommended for │
@@ -926,6 +919,7 @@ You find specific jobs within your workspace using the listing filtering options
926
919
  - **`--filter-workflow`**: Filter jobs by workflow/pipeline name (exact match required)
927
920
  - **`--filter-job-id`**: Filter jobs by specific job ID (exact match required)
928
921
  - **`--filter-only-mine`**: Show only jobs belonging to the current user
922
+ - **`--filter-owner`**: Show only job for the specified owner (exact match required, i.e needs to be in quotes and be "Name Surname")
929
923
  - **`--filter-queue`**: Filter jobs by queue name (only applies to batch jobs)
930
924
 
931
925
  Here following are some examples:
@@ -1 +0,0 @@
1
- __version__ = '2.57.0'
File without changes
File without changes
File without changes