cloudos-cli 2.47.0__tar.gz → 2.48.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.47.0 → cloudos_cli-2.48.0}/PKG-INFO +21 -2
  2. {cloudos_cli-2.47.0 → cloudos_cli-2.48.0}/README.md +20 -1
  3. {cloudos_cli-2.47.0 → cloudos_cli-2.48.0}/cloudos_cli/__main__.py +138 -26
  4. cloudos_cli-2.48.0/cloudos_cli/_version.py +1 -0
  5. {cloudos_cli-2.47.0 → cloudos_cli-2.48.0}/cloudos_cli/clos.py +46 -0
  6. {cloudos_cli-2.47.0 → cloudos_cli-2.48.0}/cloudos_cli.egg-info/PKG-INFO +21 -2
  7. {cloudos_cli-2.47.0 → cloudos_cli-2.48.0}/cloudos_cli.egg-info/SOURCES.txt +2 -1
  8. cloudos_cli-2.48.0/tests/test_cli_project_create.py +53 -0
  9. cloudos_cli-2.47.0/cloudos_cli/_version.py +0 -1
  10. {cloudos_cli-2.47.0 → cloudos_cli-2.48.0}/LICENSE +0 -0
  11. {cloudos_cli-2.47.0 → cloudos_cli-2.48.0}/cloudos_cli/__init__.py +0 -0
  12. {cloudos_cli-2.47.0 → cloudos_cli-2.48.0}/cloudos_cli/configure/__init__.py +0 -0
  13. {cloudos_cli-2.47.0 → cloudos_cli-2.48.0}/cloudos_cli/configure/configure.py +0 -0
  14. {cloudos_cli-2.47.0 → cloudos_cli-2.48.0}/cloudos_cli/datasets/__init__.py +0 -0
  15. {cloudos_cli-2.47.0 → cloudos_cli-2.48.0}/cloudos_cli/datasets/datasets.py +0 -0
  16. {cloudos_cli-2.47.0 → cloudos_cli-2.48.0}/cloudos_cli/import_wf/__init__.py +0 -0
  17. {cloudos_cli-2.47.0 → cloudos_cli-2.48.0}/cloudos_cli/import_wf/import_wf.py +0 -0
  18. {cloudos_cli-2.47.0 → cloudos_cli-2.48.0}/cloudos_cli/jobs/__init__.py +0 -0
  19. {cloudos_cli-2.47.0 → cloudos_cli-2.48.0}/cloudos_cli/jobs/job.py +0 -0
  20. {cloudos_cli-2.47.0 → cloudos_cli-2.48.0}/cloudos_cli/link/__init__.py +0 -0
  21. {cloudos_cli-2.47.0 → cloudos_cli-2.48.0}/cloudos_cli/link/link.py +0 -0
  22. {cloudos_cli-2.47.0 → cloudos_cli-2.48.0}/cloudos_cli/procurement/__init__.py +0 -0
  23. {cloudos_cli-2.47.0 → cloudos_cli-2.48.0}/cloudos_cli/procurement/images.py +0 -0
  24. {cloudos_cli-2.47.0 → cloudos_cli-2.48.0}/cloudos_cli/queue/__init__.py +0 -0
  25. {cloudos_cli-2.47.0 → cloudos_cli-2.48.0}/cloudos_cli/queue/queue.py +0 -0
  26. {cloudos_cli-2.47.0 → cloudos_cli-2.48.0}/cloudos_cli/utils/__init__.py +0 -0
  27. {cloudos_cli-2.47.0 → cloudos_cli-2.48.0}/cloudos_cli/utils/array_job.py +0 -0
  28. {cloudos_cli-2.47.0 → cloudos_cli-2.48.0}/cloudos_cli/utils/cloud.py +0 -0
  29. {cloudos_cli-2.47.0 → cloudos_cli-2.48.0}/cloudos_cli/utils/details.py +0 -0
  30. {cloudos_cli-2.47.0 → cloudos_cli-2.48.0}/cloudos_cli/utils/errors.py +0 -0
  31. {cloudos_cli-2.47.0 → cloudos_cli-2.48.0}/cloudos_cli/utils/last_wf.py +0 -0
  32. {cloudos_cli-2.47.0 → cloudos_cli-2.48.0}/cloudos_cli/utils/requests.py +0 -0
  33. {cloudos_cli-2.47.0 → cloudos_cli-2.48.0}/cloudos_cli/utils/resources.py +0 -0
  34. {cloudos_cli-2.47.0 → cloudos_cli-2.48.0}/cloudos_cli.egg-info/dependency_links.txt +0 -0
  35. {cloudos_cli-2.47.0 → cloudos_cli-2.48.0}/cloudos_cli.egg-info/entry_points.txt +0 -0
  36. {cloudos_cli-2.47.0 → cloudos_cli-2.48.0}/cloudos_cli.egg-info/requires.txt +0 -0
  37. {cloudos_cli-2.47.0 → cloudos_cli-2.48.0}/cloudos_cli.egg-info/top_level.txt +0 -0
  38. {cloudos_cli-2.47.0 → cloudos_cli-2.48.0}/setup.cfg +0 -0
  39. {cloudos_cli-2.47.0 → cloudos_cli-2.48.0}/setup.py +0 -0
  40. {cloudos_cli-2.47.0 → cloudos_cli-2.48.0}/tests/__init__.py +0 -0
  41. {cloudos_cli-2.47.0 → cloudos_cli-2.48.0}/tests/functions_for_pytest.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cloudos_cli
3
- Version: 2.47.0
3
+ Version: 2.48.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
@@ -180,7 +180,7 @@ cloudos --help
180
180
  │ configure CloudOS configuration. │
181
181
  │ cromwell Cromwell server functionality: check status, start and stop. │
182
182
  │ job CloudOS job functionality: run, check and abort jobs in CloudOS. │
183
- │ project CloudOS project functionality: list projects in CloudOS.
183
+ │ project CloudOS project functionality: list and create projects in CloudOS.
184
184
  │ queue CloudOS job queue functionality. │
185
185
  │ workflow CloudOS workflow functionality: list and import workflows. │
186
186
  ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
@@ -947,6 +947,25 @@ Executing list...
947
947
  Workflow list saved to project_list.csv
948
948
  ```
949
949
 
950
+ #### Create a new project in CloudOS
951
+
952
+ You can create a new project in your CloudOS workspace using the `project create` command.
953
+ This command requires the name of the new project and will return the project ID upon successful creation.
954
+
955
+ ```bash
956
+ cloudos project create \
957
+ --cloudos-url $CLOUDOS \
958
+ --apikey $MY_API_KEY \
959
+ --workspace-id $WORKSPACE_ID \
960
+ --new-project "My New Project"
961
+ ```
962
+
963
+ The expected output is something similar to:
964
+
965
+ ```console
966
+ Project "My New Project" created successfully with ID: 64f1a23b8e4c9d001234abcd
967
+ ```
968
+
950
969
  #### Get a list of the available job queues
951
970
 
952
971
  Job queues are required for running jobs using AWS batch executor. The available job queues in your CloudOS workspace are
@@ -145,7 +145,7 @@ cloudos --help
145
145
  │ configure CloudOS configuration. │
146
146
  │ cromwell Cromwell server functionality: check status, start and stop. │
147
147
  │ job CloudOS job functionality: run, check and abort jobs in CloudOS. │
148
- │ project CloudOS project functionality: list projects in CloudOS.
148
+ │ project CloudOS project functionality: list and create projects in CloudOS.
149
149
  │ queue CloudOS job queue functionality. │
150
150
  │ workflow CloudOS workflow functionality: list and import workflows. │
151
151
  ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
@@ -912,6 +912,25 @@ Executing list...
912
912
  Workflow list saved to project_list.csv
913
913
  ```
914
914
 
915
+ #### Create a new project in CloudOS
916
+
917
+ You can create a new project in your CloudOS workspace using the `project create` command.
918
+ This command requires the name of the new project and will return the project ID upon successful creation.
919
+
920
+ ```bash
921
+ cloudos project create \
922
+ --cloudos-url $CLOUDOS \
923
+ --apikey $MY_API_KEY \
924
+ --workspace-id $WORKSPACE_ID \
925
+ --new-project "My New Project"
926
+ ```
927
+
928
+ The expected output is something similar to:
929
+
930
+ ```console
931
+ Project "My New Project" created successfully with ID: 64f1a23b8e4c9d001234abcd
932
+ ```
933
+
915
934
  #### Get a list of the available job queues
916
935
 
917
936
  Job queues are required for running jobs using AWS batch executor. The available job queues in your CloudOS workspace are
@@ -79,7 +79,8 @@ def run_cloudos_cli(ctx):
79
79
  'import': shared_config
80
80
  },
81
81
  'project': {
82
- 'list': shared_config
82
+ 'list': shared_config,
83
+ 'create': shared_config
83
84
  },
84
85
  'cromwell': {
85
86
  'status': shared_config,
@@ -139,7 +140,8 @@ def run_cloudos_cli(ctx):
139
140
  'import': shared_config
140
141
  },
141
142
  'project': {
142
- 'list': shared_config
143
+ 'list': shared_config,
144
+ 'create': shared_config
143
145
  },
144
146
  'cromwell': {
145
147
  'status': shared_config,
@@ -186,7 +188,7 @@ def workflow():
186
188
 
187
189
  @run_cloudos_cli.group()
188
190
  def project():
189
- """CloudOS project functionality: list projects in CloudOS."""
191
+ """CloudOS project functionality: list and create projects in CloudOS."""
190
192
  print(project.__doc__ + '\n')
191
193
 
192
194
 
@@ -443,7 +445,8 @@ def run(ctx,
443
445
  'apikey': True,
444
446
  'workspace_id': True,
445
447
  'workflow_name': True,
446
- 'project_name': True
448
+ 'project_name': True,
449
+ 'procurement_id': False
447
450
  }
448
451
  # determine if the user provided all required parameters
449
452
  config_manager = ConfigurationProfile()
@@ -733,7 +736,8 @@ def job_status(ctx,
733
736
  'apikey': True,
734
737
  'workspace_id': False,
735
738
  'workflow_name': False,
736
- 'project_name': False
739
+ 'project_name': False,
740
+ 'procurement_id': False
737
741
  }
738
742
  # determine if the user provided all required parameters
739
743
  config_manager = ConfigurationProfile()
@@ -811,7 +815,8 @@ def job_logs(ctx,
811
815
  'apikey': True,
812
816
  'workspace_id': True,
813
817
  'workflow_name': False,
814
- 'project_name': False
818
+ 'project_name': False,
819
+ 'procurement_id': False
815
820
  }
816
821
  # determine if the user provided all required parameters
817
822
  config_manager = ConfigurationProfile()
@@ -888,7 +893,8 @@ def job_results(ctx,
888
893
  'apikey': True,
889
894
  'workspace_id': True,
890
895
  'workflow_name': False,
891
- 'project_name': False
896
+ 'project_name': False,
897
+ 'procurement_id': False
892
898
  }
893
899
  # determine if the user provided all required parameters
894
900
  config_manager = ConfigurationProfile()
@@ -978,7 +984,8 @@ def job_details(ctx,
978
984
  'apikey': True,
979
985
  'workspace_id': False,
980
986
  'workflow_name': False,
981
- 'project_name': False
987
+ 'project_name': False,
988
+ 'procurement_id': False
982
989
  }
983
990
  # determine if the user provided all required parameters
984
991
  config_manager = ConfigurationProfile()
@@ -1221,7 +1228,8 @@ def list_jobs(ctx,
1221
1228
  'apikey': True,
1222
1229
  'workspace_id': True,
1223
1230
  'workflow_name': False,
1224
- 'project_name': False
1231
+ 'project_name': False,
1232
+ 'procurement_id': False
1225
1233
  }
1226
1234
  # determine if the user provided all required parameters
1227
1235
  config_manager = ConfigurationProfile()
@@ -1329,7 +1337,8 @@ def abort_jobs(ctx,
1329
1337
  'apikey': True,
1330
1338
  'workspace_id': True,
1331
1339
  'workflow_name': False,
1332
- 'project_name': False
1340
+ 'project_name': False,
1341
+ 'procurement_id': False
1333
1342
  }
1334
1343
  # determine if the user provided all required parameters
1335
1344
  config_manager = ConfigurationProfile()
@@ -1437,7 +1446,8 @@ def list_workflows(ctx,
1437
1446
  'apikey': True,
1438
1447
  'workspace_id': True,
1439
1448
  'workflow_name': False,
1440
- 'project_name': False
1449
+ 'project_name': False,
1450
+ 'procurement_id': False
1441
1451
  }
1442
1452
  # determine if the user provided all required parameters
1443
1453
  config_manager = ConfigurationProfile()
@@ -1534,7 +1544,8 @@ def import_wf(ctx,
1534
1544
  'apikey': True,
1535
1545
  'workspace_id': True,
1536
1546
  'workflow_name': True,
1537
- 'project_name': False
1547
+ 'project_name': False,
1548
+ 'procurement_id': False
1538
1549
  }
1539
1550
  # determine if the user provided all required parameters
1540
1551
  config_manager = ConfigurationProfile()
@@ -1630,7 +1641,8 @@ def list_projects(ctx,
1630
1641
  'apikey': True,
1631
1642
  'workspace_id': True,
1632
1643
  'workflow_name': False,
1633
- 'project_name': False
1644
+ 'project_name': False,
1645
+ 'procurement_id': False
1634
1646
  }
1635
1647
  # determine if the user provided all required parameters
1636
1648
  config_manager = ConfigurationProfile()
@@ -1691,6 +1703,93 @@ def list_projects(ctx,
1691
1703
  print(f'\tProject list saved to {outfile}')
1692
1704
 
1693
1705
 
1706
+ @project.command('create')
1707
+ @click.option('-k',
1708
+ '--apikey',
1709
+ help='Your CloudOS API key',
1710
+ required=True)
1711
+ @click.option('-c',
1712
+ '--cloudos-url',
1713
+ help=(f'The CloudOS url you are trying to access to. Default={CLOUDOS_URL}.'),
1714
+ default=CLOUDOS_URL,
1715
+ required=True)
1716
+ @click.option('--workspace-id',
1717
+ help='The specific CloudOS workspace id.',
1718
+ required=True)
1719
+ @click.option('--new-project',
1720
+ help='The name for the new project.',
1721
+ required=True)
1722
+ @click.option('--verbose',
1723
+ help='Whether to print information messages or not.',
1724
+ is_flag=True)
1725
+ @click.option('--disable-ssl-verification',
1726
+ help=('Disable SSL certificate verification. Please, remember that this option is ' +
1727
+ 'not generally recommended for security reasons.'),
1728
+ is_flag=True)
1729
+ @click.option('--ssl-cert',
1730
+ help='Path to your SSL certificate file.')
1731
+ @click.option('--profile', help='Profile to use from the config file', default=None)
1732
+ @click.pass_context
1733
+ def create_project(ctx,
1734
+ apikey,
1735
+ cloudos_url,
1736
+ workspace_id,
1737
+ new_project,
1738
+ verbose,
1739
+ disable_ssl_verification,
1740
+ ssl_cert,
1741
+ profile):
1742
+ """Create a new project in CloudOS."""
1743
+ profile = profile or ctx.default_map['project']['create']['profile']
1744
+ # Create a dictionary with required and non-required params
1745
+ required_dict = {
1746
+ 'apikey': True,
1747
+ 'workspace_id': True,
1748
+ 'workflow_name': False,
1749
+ 'project_name': False,
1750
+ 'procurement_id': False
1751
+ }
1752
+ # determine if the user provided all required parameters
1753
+ config_manager = ConfigurationProfile()
1754
+ user_options = (
1755
+ config_manager.load_profile_and_validate_data(
1756
+ ctx,
1757
+ INIT_PROFILE,
1758
+ CLOUDOS_URL,
1759
+ profile=profile,
1760
+ required_dict=required_dict,
1761
+ apikey=apikey,
1762
+ cloudos_url=cloudos_url,
1763
+ workspace_id=workspace_id,
1764
+ project_name=new_project
1765
+ )
1766
+ )
1767
+ # replace the profile parameters with arguments given by the user
1768
+ apikey = user_options['apikey']
1769
+ cloudos_url = user_options['cloudos_url']
1770
+ workspace_id = user_options['workspace_id']
1771
+
1772
+ # verify ssl configuration
1773
+ verify_ssl = ssl_selector(disable_ssl_verification, ssl_cert)
1774
+
1775
+ # Print basic output
1776
+ if verbose:
1777
+ print(f'\tUsing CloudOS URL: {cloudos_url}')
1778
+ print(f'\tUsing workspace: {workspace_id}')
1779
+ print(f'\tProject name: {new_project}')
1780
+
1781
+ cl = Cloudos(cloudos_url=cloudos_url, apikey=apikey, cromwell_token=None)
1782
+
1783
+ try:
1784
+ project_id = cl.create_project(workspace_id, new_project, verify_ssl)
1785
+ print(f'\tProject "{new_project}" created successfully with ID: {project_id}')
1786
+ if verbose:
1787
+ print(f'\tProject URL: {cloudos_url}/app/projects/{project_id}')
1788
+ except Exception as e:
1789
+ print(f'\tError creating project: {str(e)}')
1790
+ sys.exit(1)
1791
+
1792
+
1694
1793
  @cromwell.command('status')
1695
1794
  @click.version_option()
1696
1795
  @click.option('-k',
@@ -1735,7 +1834,8 @@ def cromwell_status(ctx,
1735
1834
  'apikey': True,
1736
1835
  'workspace_id': True,
1737
1836
  'workflow_name': False,
1738
- 'project_name': False
1837
+ 'project_name': False,
1838
+ 'procurement_id': False
1739
1839
  }
1740
1840
  # determine if the user provided all required parameters
1741
1841
  config_manager = ConfigurationProfile()
@@ -1819,7 +1919,8 @@ def cromwell_restart(ctx,
1819
1919
  'apikey': True,
1820
1920
  'workspace_id': True,
1821
1921
  'workflow_name': False,
1822
- 'project_name': False
1922
+ 'project_name': False,
1923
+ 'procurement_id': False
1823
1924
  }
1824
1925
  # determine if the user provided all required parameters
1825
1926
  config_manager = ConfigurationProfile()
@@ -1920,7 +2021,8 @@ def cromwell_stop(ctx,
1920
2021
  'apikey': True,
1921
2022
  'workspace_id': True,
1922
2023
  'workflow_name': False,
1923
- 'project_name': False
2024
+ 'project_name': False,
2025
+ 'procurement_id': False
1924
2026
  }
1925
2027
  # determine if the user provided all required parameters
1926
2028
  config_manager = ConfigurationProfile()
@@ -2009,7 +2111,8 @@ def list_queues(ctx,
2009
2111
  'apikey': True,
2010
2112
  'workspace_id': True,
2011
2113
  'workflow_name': False,
2012
- 'project_name': False
2114
+ 'project_name': False,
2115
+ 'procurement_id': False
2013
2116
  }
2014
2117
  # determine if the user provided all required parameters
2015
2118
  config_manager = ConfigurationProfile()
@@ -2198,7 +2301,8 @@ def run_bash_job(ctx,
2198
2301
  'apikey': True,
2199
2302
  'workspace_id': True,
2200
2303
  'workflow_name': True,
2201
- 'project_name': True
2304
+ 'project_name': True,
2305
+ 'procurement_id': False
2202
2306
  }
2203
2307
 
2204
2308
  # determine if the user provided all required parameters
@@ -2485,7 +2589,8 @@ def run_bash_array_job(ctx,
2485
2589
  'apikey': True,
2486
2590
  'workspace_id': True,
2487
2591
  'workflow_name': True,
2488
- 'project_name': True
2592
+ 'project_name': True,
2593
+ 'procurement_id': False
2489
2594
  }
2490
2595
 
2491
2596
  # determine if the user provided all required parameters
@@ -2715,7 +2820,8 @@ def list_files(ctx,
2715
2820
  'apikey': True,
2716
2821
  'workspace_id': True,
2717
2822
  'workflow_name': False,
2718
- 'project_name': False
2823
+ 'project_name': False,
2824
+ 'procurement_id': False
2719
2825
  }
2720
2826
 
2721
2827
  user_options = config_manager.load_profile_and_validate_data(
@@ -2861,7 +2967,8 @@ def move_files(ctx, source_path, destination_path, apikey, cloudos_url, workspac
2861
2967
  'apikey': True,
2862
2968
  'workspace_id': True,
2863
2969
  'workflow_name': False,
2864
- 'project_name': True
2970
+ 'project_name': True,
2971
+ 'procurement_id': False
2865
2972
  }
2866
2973
 
2867
2974
  user_options = (
@@ -3013,7 +3120,8 @@ def renaming_item(ctx, source_path, new_name, apikey, cloudos_url,
3013
3120
  'apikey': True,
3014
3121
  'workspace_id': True,
3015
3122
  'workflow_name': False,
3016
- 'project_name': True
3123
+ 'project_name': True,
3124
+ 'procurement_id': False
3017
3125
  }
3018
3126
 
3019
3127
  user_options = (
@@ -3122,7 +3230,8 @@ def copy_item_cli(ctx, source_path, destination_path, apikey, cloudos_url,
3122
3230
  'apikey': True,
3123
3231
  'workspace_id': True,
3124
3232
  'workflow_name': False,
3125
- 'project_name': True
3233
+ 'project_name': True,
3234
+ 'procurement_id': False
3126
3235
  }
3127
3236
  user_options = config_manager.load_profile_and_validate_data(
3128
3237
  ctx, INIT_PROFILE, CLOUDOS_URL, profile=profile,
@@ -3266,7 +3375,8 @@ def mkdir_item(ctx, new_folder_path, apikey, cloudos_url,
3266
3375
  'apikey': True,
3267
3376
  'workspace_id': True,
3268
3377
  'workflow_name': False,
3269
- 'project_name': True
3378
+ 'project_name': True,
3379
+ 'procurement_id': False
3270
3380
  }
3271
3381
 
3272
3382
  user_options = (
@@ -3376,7 +3486,8 @@ def rm_item(ctx, target_path, apikey, cloudos_url,
3376
3486
  'apikey': True,
3377
3487
  'workspace_id': True,
3378
3488
  'workflow_name': False,
3379
- 'project_name': True
3489
+ 'project_name': True,
3490
+ 'procurement_id': False
3380
3491
  }
3381
3492
 
3382
3493
  user_options = (
@@ -3484,7 +3595,8 @@ def link(ctx, path, apikey, cloudos_url, project_name, workspace_id, session_id,
3484
3595
  'apikey': True,
3485
3596
  'workspace_id': True,
3486
3597
  'workflow_name': False,
3487
- 'project_name': False
3598
+ 'project_name': False,
3599
+ 'procurement_id': False
3488
3600
  }
3489
3601
  # determine if the user provided all required parameters
3490
3602
  config_manager = ConfigurationProfile()
@@ -0,0 +1 @@
1
+ __version__ = '2.48.0'
@@ -916,6 +916,52 @@ class Cloudos:
916
916
 
917
917
  return project_id
918
918
 
919
+ def create_project(self, workspace_id, project_name, verify=True):
920
+ """Create a new project in CloudOS.
921
+
922
+ Parameters
923
+ ----------
924
+ workspace_id : str
925
+ The CloudOS workspace ID where the project will be created.
926
+ project_name : str
927
+ The name for the new project.
928
+ verify : [bool | str], optional
929
+ Whether to use SSL verification or not. Alternatively, if
930
+ a string is passed, it will be interpreted as the path to
931
+ the SSL certificate file. Default is True.
932
+
933
+ Returns
934
+ -------
935
+ str
936
+ The ID of the newly created project.
937
+
938
+ Raises
939
+ ------
940
+ BadRequestException
941
+ If the request to create the project fails with a status code
942
+ indicating an error.
943
+ """
944
+ data = {
945
+ "name": project_name
946
+ }
947
+ headers = {
948
+ "Content-type": "application/json",
949
+ "apikey": self.apikey
950
+ }
951
+ r = retry_requests_post("{}/api/v1/projects?teamId={}".format(self.cloudos_url,
952
+ workspace_id),
953
+ json=data, headers=headers, verify=verify)
954
+ if r.status_code == 401:
955
+ raise ValueError('It seems your API key is not authorised. Please check if ' +
956
+ 'you have used the correct API key for the selected workspace')
957
+ elif r.status_code == 409:
958
+ raise ValueError(f'It seems that there is another project named "{project_name}" ' +
959
+ 'in your workspace, please use another name for the new project')
960
+ elif r.status_code >= 400:
961
+ raise BadRequestException(r)
962
+ content = json.loads(r.content)
963
+ return content['_id']
964
+
919
965
  def get_workflow_max_pagination(self, workspace_id, workflow_name, verify=True):
920
966
  """Retrieve the workflows max pages from API.
921
967
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cloudos_cli
3
- Version: 2.47.0
3
+ Version: 2.48.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
@@ -180,7 +180,7 @@ cloudos --help
180
180
  │ configure CloudOS configuration. │
181
181
  │ cromwell Cromwell server functionality: check status, start and stop. │
182
182
  │ job CloudOS job functionality: run, check and abort jobs in CloudOS. │
183
- │ project CloudOS project functionality: list projects in CloudOS.
183
+ │ project CloudOS project functionality: list and create projects in CloudOS.
184
184
  │ queue CloudOS job queue functionality. │
185
185
  │ workflow CloudOS workflow functionality: list and import workflows. │
186
186
  ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
@@ -947,6 +947,25 @@ Executing list...
947
947
  Workflow list saved to project_list.csv
948
948
  ```
949
949
 
950
+ #### Create a new project in CloudOS
951
+
952
+ You can create a new project in your CloudOS workspace using the `project create` command.
953
+ This command requires the name of the new project and will return the project ID upon successful creation.
954
+
955
+ ```bash
956
+ cloudos project create \
957
+ --cloudos-url $CLOUDOS \
958
+ --apikey $MY_API_KEY \
959
+ --workspace-id $WORKSPACE_ID \
960
+ --new-project "My New Project"
961
+ ```
962
+
963
+ The expected output is something similar to:
964
+
965
+ ```console
966
+ Project "My New Project" created successfully with ID: 64f1a23b8e4c9d001234abcd
967
+ ```
968
+
950
969
  #### Get a list of the available job queues
951
970
 
952
971
  Job queues are required for running jobs using AWS batch executor. The available job queues in your CloudOS workspace are
@@ -34,4 +34,5 @@ cloudos_cli/utils/last_wf.py
34
34
  cloudos_cli/utils/requests.py
35
35
  cloudos_cli/utils/resources.py
36
36
  tests/__init__.py
37
- tests/functions_for_pytest.py
37
+ tests/functions_for_pytest.py
38
+ tests/test_cli_project_create.py
@@ -0,0 +1,53 @@
1
+ import pytest
2
+ from click.testing import CliRunner
3
+ from cloudos_cli.__main__ import run_cloudos_cli
4
+
5
+
6
+ def test_project_create_command_exists():
7
+ """
8
+ Test that the 'project create' command exists and shows proper help
9
+ """
10
+ runner = CliRunner()
11
+
12
+ # Test that project create command exists
13
+ result = runner.invoke(run_cloudos_cli, ['project', 'create', '--help'])
14
+
15
+ # Command should exist and not error out
16
+ assert result.exit_code == 0
17
+
18
+ # Check that the help text contains expected options
19
+ assert 'Create a new project in CloudOS' in result.output
20
+ assert '--new-project' in result.output
21
+ assert '--workspace-id' in result.output
22
+ assert '--apikey' in result.output
23
+ assert '--cloudos-url' in result.output
24
+
25
+
26
+ def test_project_create_command_structure():
27
+ """
28
+ Test that the 'project create' command has the correct structure and options
29
+ """
30
+ runner = CliRunner()
31
+
32
+ # Test that the command exists and can show help without making API calls
33
+ result = runner.invoke(run_cloudos_cli, ['project', 'create', '--help'])
34
+
35
+ # Command should exist and show help properly
36
+ assert result.exit_code == 0
37
+ assert 'Create a new project in CloudOS' in result.output
38
+ assert '--new-project' in result.output
39
+ assert 'required' in result.output # Required arguments should be marked as such
40
+
41
+
42
+ def test_project_group_contains_create_command():
43
+ """
44
+ Test that the 'project' group contains the 'create' command
45
+ """
46
+ runner = CliRunner()
47
+
48
+ # Test that project group shows create command
49
+ result = runner.invoke(run_cloudos_cli, ['project', '--help'])
50
+
51
+ assert result.exit_code == 0
52
+ assert 'create' in result.output
53
+ assert 'Create a new project in CloudOS' in result.output
@@ -1 +0,0 @@
1
- __version__ = '2.47.0'
File without changes
File without changes
File without changes