cloudos-cli 2.37.0__tar.gz → 2.38.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 (37) hide show
  1. {cloudos_cli-2.37.0 → cloudos_cli-2.38.0}/PKG-INFO +28 -2
  2. {cloudos_cli-2.37.0 → cloudos_cli-2.38.0}/README.md +27 -1
  3. {cloudos_cli-2.37.0 → cloudos_cli-2.38.0}/cloudos_cli/__main__.py +216 -43
  4. cloudos_cli-2.38.0/cloudos_cli/_version.py +1 -0
  5. {cloudos_cli-2.37.0 → cloudos_cli-2.38.0}/cloudos_cli/configure/configure.py +44 -7
  6. cloudos_cli-2.38.0/cloudos_cli/link/__init__.py +8 -0
  7. cloudos_cli-2.38.0/cloudos_cli/link/link.py +125 -0
  8. {cloudos_cli-2.37.0 → cloudos_cli-2.38.0}/cloudos_cli.egg-info/PKG-INFO +28 -2
  9. {cloudos_cli-2.37.0 → cloudos_cli-2.38.0}/cloudos_cli.egg-info/SOURCES.txt +2 -0
  10. cloudos_cli-2.37.0/cloudos_cli/_version.py +0 -1
  11. {cloudos_cli-2.37.0 → cloudos_cli-2.38.0}/LICENSE +0 -0
  12. {cloudos_cli-2.37.0 → cloudos_cli-2.38.0}/cloudos_cli/__init__.py +0 -0
  13. {cloudos_cli-2.37.0 → cloudos_cli-2.38.0}/cloudos_cli/clos.py +0 -0
  14. {cloudos_cli-2.37.0 → cloudos_cli-2.38.0}/cloudos_cli/configure/__init__.py +0 -0
  15. {cloudos_cli-2.37.0 → cloudos_cli-2.38.0}/cloudos_cli/datasets/__init__.py +0 -0
  16. {cloudos_cli-2.37.0 → cloudos_cli-2.38.0}/cloudos_cli/datasets/datasets.py +0 -0
  17. {cloudos_cli-2.37.0 → cloudos_cli-2.38.0}/cloudos_cli/import_wf/__init__.py +0 -0
  18. {cloudos_cli-2.37.0 → cloudos_cli-2.38.0}/cloudos_cli/import_wf/import_wf.py +0 -0
  19. {cloudos_cli-2.37.0 → cloudos_cli-2.38.0}/cloudos_cli/jobs/__init__.py +0 -0
  20. {cloudos_cli-2.37.0 → cloudos_cli-2.38.0}/cloudos_cli/jobs/job.py +0 -0
  21. {cloudos_cli-2.37.0 → cloudos_cli-2.38.0}/cloudos_cli/queue/__init__.py +0 -0
  22. {cloudos_cli-2.37.0 → cloudos_cli-2.38.0}/cloudos_cli/queue/queue.py +0 -0
  23. {cloudos_cli-2.37.0 → cloudos_cli-2.38.0}/cloudos_cli/utils/__init__.py +0 -0
  24. {cloudos_cli-2.37.0 → cloudos_cli-2.38.0}/cloudos_cli/utils/array_job.py +0 -0
  25. {cloudos_cli-2.37.0 → cloudos_cli-2.38.0}/cloudos_cli/utils/cloud.py +0 -0
  26. {cloudos_cli-2.37.0 → cloudos_cli-2.38.0}/cloudos_cli/utils/details.py +0 -0
  27. {cloudos_cli-2.37.0 → cloudos_cli-2.38.0}/cloudos_cli/utils/errors.py +0 -0
  28. {cloudos_cli-2.37.0 → cloudos_cli-2.38.0}/cloudos_cli/utils/requests.py +0 -0
  29. {cloudos_cli-2.37.0 → cloudos_cli-2.38.0}/cloudos_cli/utils/resources.py +0 -0
  30. {cloudos_cli-2.37.0 → cloudos_cli-2.38.0}/cloudos_cli.egg-info/dependency_links.txt +0 -0
  31. {cloudos_cli-2.37.0 → cloudos_cli-2.38.0}/cloudos_cli.egg-info/entry_points.txt +0 -0
  32. {cloudos_cli-2.37.0 → cloudos_cli-2.38.0}/cloudos_cli.egg-info/requires.txt +0 -0
  33. {cloudos_cli-2.37.0 → cloudos_cli-2.38.0}/cloudos_cli.egg-info/top_level.txt +0 -0
  34. {cloudos_cli-2.37.0 → cloudos_cli-2.38.0}/setup.cfg +0 -0
  35. {cloudos_cli-2.37.0 → cloudos_cli-2.38.0}/setup.py +0 -0
  36. {cloudos_cli-2.37.0 → cloudos_cli-2.38.0}/tests/__init__.py +0 -0
  37. {cloudos_cli-2.37.0 → cloudos_cli-2.38.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.37.0
3
+ Version: 2.38.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
@@ -106,7 +106,7 @@ In order to generate a profile called `default`, the following command can be us
106
106
  cloudos configure
107
107
  ```
108
108
 
109
- This will bring in prompts for API, platform URL, project name, platform executor, repository provider, workflow name (if any). This will be the default profile if no other was explicitly set. The default profile allows running all subcommands without adding `--profile` option in the command line.
109
+ This will bring in prompts for API, platform URL, project name, platform executor, repository provider, workflow name (if any) and session ID for interactive analysis. This will be the default profile if no other was explicitly set. The default profile allows running all subcommands without adding `--profile` option in the command line.
110
110
 
111
111
  ### Configure named profile
112
112
 
@@ -1089,6 +1089,32 @@ Please, note that in the above example a preconfigured profile has been used. If
1089
1089
  --project-name $PROJEC_NAME
1090
1090
  ```
1091
1091
 
1092
+ #### Linking S3 folders to Interactive Analysis
1093
+
1094
+ The CLI can link S3 folders into an interactive session, which will appear in the left panel of the session as "mounted". This subcommand is using the option `--session-id` to access the correct interactive session. This option can be added to the CLI or defined in a profile, for convenience.
1095
+
1096
+ The usage of the subcommand is as follows:
1097
+
1098
+ ```console
1099
+ cloudos datasets link <S3 FOLDER COMPLETE PATH> <options>
1100
+ ```
1101
+
1102
+ For example:
1103
+
1104
+ ```console
1105
+ cloudos datasets link s3://bucket/path/folder --profile test
1106
+ ```
1107
+ where profile `test` has already defined the `--session-id`.
1108
+
1109
+ Or specifying explicitly:
1110
+
1111
+ ```console
1112
+ cloudos datasets link s3://bucket/path/folder --profile test --session-id 1234
1113
+ ```
1114
+ where profile `test` is used for all other necessary variables, but `--session-id` is overwritten from the command line.
1115
+
1116
+ > [!NOTE]
1117
+ > If running the CLI inside a jupyter session, the pre-configured CLI installation will have the session ID already installed and only the `--apikey` needs to be added.
1092
1118
 
1093
1119
  #### Create a (virtual) folder
1094
1120
 
@@ -71,7 +71,7 @@ In order to generate a profile called `default`, the following command can be us
71
71
  cloudos configure
72
72
  ```
73
73
 
74
- This will bring in prompts for API, platform URL, project name, platform executor, repository provider, workflow name (if any). This will be the default profile if no other was explicitly set. The default profile allows running all subcommands without adding `--profile` option in the command line.
74
+ This will bring in prompts for API, platform URL, project name, platform executor, repository provider, workflow name (if any) and session ID for interactive analysis. This will be the default profile if no other was explicitly set. The default profile allows running all subcommands without adding `--profile` option in the command line.
75
75
 
76
76
  ### Configure named profile
77
77
 
@@ -1054,6 +1054,32 @@ Please, note that in the above example a preconfigured profile has been used. If
1054
1054
  --project-name $PROJEC_NAME
1055
1055
  ```
1056
1056
 
1057
+ #### Linking S3 folders to Interactive Analysis
1058
+
1059
+ The CLI can link S3 folders into an interactive session, which will appear in the left panel of the session as "mounted". This subcommand is using the option `--session-id` to access the correct interactive session. This option can be added to the CLI or defined in a profile, for convenience.
1060
+
1061
+ The usage of the subcommand is as follows:
1062
+
1063
+ ```console
1064
+ cloudos datasets link <S3 FOLDER COMPLETE PATH> <options>
1065
+ ```
1066
+
1067
+ For example:
1068
+
1069
+ ```console
1070
+ cloudos datasets link s3://bucket/path/folder --profile test
1071
+ ```
1072
+ where profile `test` has already defined the `--session-id`.
1073
+
1074
+ Or specifying explicitly:
1075
+
1076
+ ```console
1077
+ cloudos datasets link s3://bucket/path/folder --profile test --session-id 1234
1078
+ ```
1079
+ where profile `test` is used for all other necessary variables, but `--session-id` is overwritten from the command line.
1080
+
1081
+ > [!NOTE]
1082
+ > If running the CLI inside a jupyter session, the pre-configured CLI installation will have the session ID already installed and only the `--apikey` needs to be added.
1057
1083
 
1058
1084
  #### Create a (virtual) folder
1059
1085
 
@@ -18,6 +18,7 @@ from cloudos_cli.utils.resources import ssl_selector, format_bytes
18
18
  from rich.style import Style
19
19
  from cloudos_cli.utils.array_job import generate_datasets_for_project
20
20
  from cloudos_cli.utils.details import get_path
21
+ from cloudos_cli.link import Link
21
22
 
22
23
 
23
24
  # GLOBAL VARS
@@ -46,7 +47,10 @@ def run_cloudos_cli(ctx):
46
47
  config_manager = ConfigurationProfile()
47
48
  profile_to_use = config_manager.determine_default_profile()
48
49
  if profile_to_use is None:
49
- print('[Warning] No profile found. Please create one with "cloudos configure".\n')
50
+ console = Console()
51
+ console.print(
52
+ "[bold yellow][Warning] No profile found. Please create one with \"cloudos configure\"."
53
+ )
50
54
  shared_config = dict({
51
55
  'apikey': '',
52
56
  'cloudos_url': CLOUDOS_URL,
@@ -55,7 +59,8 @@ def run_cloudos_cli(ctx):
55
59
  'workflow_name': '',
56
60
  'repository_platform': 'github',
57
61
  'execution_platform': 'aws',
58
- 'profile': INIT_PROFILE
62
+ 'profile': INIT_PROFILE,
63
+ 'session_id': '',
59
64
  })
60
65
  ctx.default_map = dict({
61
66
  'job': {
@@ -91,6 +96,7 @@ def run_cloudos_cli(ctx):
91
96
  'mv': shared_config,
92
97
  'rename': shared_config,
93
98
  'cp': shared_config,
99
+ 'link': shared_config,
94
100
  'mkdir': shared_config,
95
101
  'rm': shared_config
96
102
  }
@@ -105,7 +111,8 @@ def run_cloudos_cli(ctx):
105
111
  'workflow_name': profile_data.get('workflow_name', ""),
106
112
  'repository_platform': profile_data.get('repository_platform', ""),
107
113
  'execution_platform': profile_data.get('execution_platform', ""),
108
- 'profile': profile_to_use
114
+ 'profile': profile_to_use,
115
+ 'session_id': profile_data.get('session_id', "")
109
116
  })
110
117
  ctx.default_map = dict({
111
118
  'job': {
@@ -141,6 +148,7 @@ def run_cloudos_cli(ctx):
141
148
  'mv': shared_config,
142
149
  'rename': shared_config,
143
150
  'cp': shared_config,
151
+ 'link': shared_config,
144
152
  'mkdir': shared_config,
145
153
  'rm': shared_config
146
154
  }
@@ -211,7 +219,6 @@ def configure(ctx, profile, make_default):
211
219
  if make_default:
212
220
  config_manager.make_default_profile(profile_name=profile)
213
221
 
214
-
215
222
  @job.command('run')
216
223
  @click.option('-k',
217
224
  '--apikey',
@@ -220,7 +227,8 @@ def configure(ctx, profile, make_default):
220
227
  @click.option('-c',
221
228
  '--cloudos-url',
222
229
  help=(f'The CloudOS url you are trying to access to. Default={CLOUDOS_URL}.'),
223
- default=CLOUDOS_URL)
230
+ default=CLOUDOS_URL,
231
+ required=True)
224
232
  @click.option('--workspace-id',
225
233
  help='The specific CloudOS workspace id.',
226
234
  required=True)
@@ -407,7 +415,7 @@ def run(ctx,
407
415
  }
408
416
  # determine if the user provided all required parameters
409
417
  config_manager = ConfigurationProfile()
410
- apikey, cloudos_url, workspace_id, workflow_name, repository_platform, execution_platform, project_name = (
418
+ user_options = (
411
419
  config_manager.load_profile_and_validate_data(
412
420
  ctx,
413
421
  INIT_PROFILE,
@@ -423,6 +431,13 @@ def run(ctx,
423
431
  project_name=project_name
424
432
  )
425
433
  )
434
+ apikey = user_options['apikey']
435
+ cloudos_url = user_options['cloudos_url']
436
+ workspace_id = user_options['workspace_id']
437
+ workflow_name = user_options['workflow_name']
438
+ repository_platform = user_options['repository_platform']
439
+ execution_platform = user_options['execution_platform']
440
+ project_name = user_options['project_name']
426
441
 
427
442
  verify_ssl = ssl_selector(disable_ssl_verification, ssl_cert)
428
443
  if do_not_save_logs:
@@ -655,7 +670,8 @@ def run(ctx,
655
670
  @click.option('-c',
656
671
  '--cloudos-url',
657
672
  help=(f'The CloudOS url you are trying to access to. Default={CLOUDOS_URL}.'),
658
- default=CLOUDOS_URL)
673
+ default=CLOUDOS_URL,
674
+ required=True)
659
675
  @click.option('--job-id',
660
676
  help='The job id in CloudOS to search for.',
661
677
  required=True)
@@ -689,7 +705,7 @@ def job_status(ctx,
689
705
  }
690
706
  # determine if the user provided all required parameters
691
707
  config_manager = ConfigurationProfile()
692
- apikey, cloudos_url, workspace_id, workflow_name, repository_platform, execution_platform, project_name = (
708
+ user_options = (
693
709
  config_manager.load_profile_and_validate_data(
694
710
  ctx,
695
711
  INIT_PROFILE,
@@ -700,6 +716,8 @@ def job_status(ctx,
700
716
  cloudos_url=cloudos_url
701
717
  )
702
718
  )
719
+ apikey = user_options['apikey']
720
+ cloudos_url = user_options['cloudos_url']
703
721
 
704
722
  print('Executing status...')
705
723
  verify_ssl = ssl_selector(disable_ssl_verification, ssl_cert)
@@ -726,7 +744,8 @@ def job_status(ctx,
726
744
  @click.option('-c',
727
745
  '--cloudos-url',
728
746
  help=(f'The CloudOS url you are trying to access to. Default={CLOUDOS_URL}.'),
729
- default=CLOUDOS_URL)
747
+ default=CLOUDOS_URL,
748
+ required=True)
730
749
  @click.option('--workspace-id',
731
750
  help='The specific CloudOS workspace id.',
732
751
  required=True)
@@ -764,7 +783,7 @@ def job_logs(ctx,
764
783
  }
765
784
  # determine if the user provided all required parameters
766
785
  config_manager = ConfigurationProfile()
767
- apikey, cloudos_url, workspace_id, workflow_name, repository_platform, execution_platform, project_name = (
786
+ user_options = (
768
787
  config_manager.load_profile_and_validate_data(
769
788
  ctx,
770
789
  INIT_PROFILE,
@@ -776,6 +795,9 @@ def job_logs(ctx,
776
795
  workspace_id=workspace_id
777
796
  )
778
797
  )
798
+ apikey = user_options['apikey']
799
+ cloudos_url = user_options['cloudos_url']
800
+ workspace_id = user_options['workspace_id']
779
801
 
780
802
  print('Executing logs...')
781
803
  verify_ssl = ssl_selector(disable_ssl_verification, ssl_cert)
@@ -799,7 +821,8 @@ def job_logs(ctx,
799
821
  @click.option('-c',
800
822
  '--cloudos-url',
801
823
  help=(f'The CloudOS url you are trying to access to. Default={CLOUDOS_URL}.'),
802
- default=CLOUDOS_URL)
824
+ default=CLOUDOS_URL,
825
+ required=True)
803
826
  @click.option('--workspace-id',
804
827
  help='The specific CloudOS workspace id.',
805
828
  required=True)
@@ -837,7 +860,7 @@ def job_results(ctx,
837
860
  }
838
861
  # determine if the user provided all required parameters
839
862
  config_manager = ConfigurationProfile()
840
- apikey, cloudos_url, workspace_id, workflow_name, repository_platform, execution_platform, project_name = (
863
+ user_options = (
841
864
  config_manager.load_profile_and_validate_data(
842
865
  ctx,
843
866
  INIT_PROFILE,
@@ -849,6 +872,9 @@ def job_results(ctx,
849
872
  workspace_id=workspace_id
850
873
  )
851
874
  )
875
+ apikey = user_options['apikey']
876
+ cloudos_url = user_options['cloudos_url']
877
+ workspace_id = user_options['workspace_id']
852
878
 
853
879
  print('Executing results...')
854
880
  verify_ssl = ssl_selector(disable_ssl_verification, ssl_cert)
@@ -872,7 +898,8 @@ def job_results(ctx,
872
898
  @click.option('-c',
873
899
  '--cloudos-url',
874
900
  help=(f'The CloudOS url you are trying to access to. Default={CLOUDOS_URL}.'),
875
- default=CLOUDOS_URL)
901
+ default=CLOUDOS_URL,
902
+ required=True)
876
903
  @click.option('--job-id',
877
904
  help='The job id in CloudOS to search for.',
878
905
  required=True)
@@ -923,7 +950,7 @@ def job_details(ctx,
923
950
  }
924
951
  # determine if the user provided all required parameters
925
952
  config_manager = ConfigurationProfile()
926
- apikey, cloudos_url, workspace_id, workflow_name, repository_platform, execution_platform, project_name = (
953
+ user_options = (
927
954
  config_manager.load_profile_and_validate_data(
928
955
  ctx,
929
956
  INIT_PROFILE,
@@ -934,6 +961,9 @@ def job_details(ctx,
934
961
  cloudos_url=cloudos_url
935
962
  )
936
963
  )
964
+ apikey = user_options['apikey']
965
+ cloudos_url = user_options['cloudos_url']
966
+ execution_platform = user_options['execution_platform']
937
967
 
938
968
  print('Executing details...')
939
969
  verify_ssl = ssl_selector(disable_ssl_verification, ssl_cert)
@@ -1096,7 +1126,8 @@ def job_details(ctx,
1096
1126
  @click.option('-c',
1097
1127
  '--cloudos-url',
1098
1128
  help=(f'The CloudOS url you are trying to access to. Default={CLOUDOS_URL}.'),
1099
- default=CLOUDOS_URL)
1129
+ default=CLOUDOS_URL,
1130
+ required=True)
1100
1131
  @click.option('--workspace-id',
1101
1132
  help='The specific CloudOS workspace id.',
1102
1133
  required=True)
@@ -1162,7 +1193,7 @@ def list_jobs(ctx,
1162
1193
  }
1163
1194
  # determine if the user provided all required parameters
1164
1195
  config_manager = ConfigurationProfile()
1165
- apikey, cloudos_url, workspace_id, workflow_name, repository_platform, execution_platform, project_name = (
1196
+ user_options = (
1166
1197
  config_manager.load_profile_and_validate_data(
1167
1198
  ctx,
1168
1199
  INIT_PROFILE,
@@ -1174,6 +1205,9 @@ def list_jobs(ctx,
1174
1205
  workspace_id=workspace_id
1175
1206
  )
1176
1207
  )
1208
+ apikey = user_options['apikey']
1209
+ cloudos_url = user_options['cloudos_url']
1210
+ workspace_id = user_options['workspace_id']
1177
1211
 
1178
1212
  verify_ssl = ssl_selector(disable_ssl_verification, ssl_cert)
1179
1213
  outfile = output_basename + '.' + output_format
@@ -1226,7 +1260,8 @@ def list_jobs(ctx,
1226
1260
  @click.option('-c',
1227
1261
  '--cloudos-url',
1228
1262
  help=(f'The CloudOS url you are trying to access to. Default={CLOUDOS_URL}.'),
1229
- default=CLOUDOS_URL)
1263
+ default=CLOUDOS_URL,
1264
+ required=True)
1230
1265
  @click.option('--workspace-id',
1231
1266
  help='The specific CloudOS workspace id.',
1232
1267
  required=True)
@@ -1266,7 +1301,7 @@ def abort_jobs(ctx,
1266
1301
  }
1267
1302
  # determine if the user provided all required parameters
1268
1303
  config_manager = ConfigurationProfile()
1269
- apikey, cloudos_url, workspace_id, workflow_name, repository_platform, execution_platform, project_name = (
1304
+ user_options = (
1270
1305
  config_manager.load_profile_and_validate_data(
1271
1306
  ctx,
1272
1307
  INIT_PROFILE,
@@ -1278,6 +1313,9 @@ def abort_jobs(ctx,
1278
1313
  workspace_id=workspace_id
1279
1314
  )
1280
1315
  )
1316
+ apikey = user_options['apikey']
1317
+ cloudos_url = user_options['cloudos_url']
1318
+ workspace_id = user_options['workspace_id']
1281
1319
 
1282
1320
  verify_ssl = ssl_selector(disable_ssl_verification, ssl_cert)
1283
1321
  print('Aborting jobs...')
@@ -1319,7 +1357,8 @@ def abort_jobs(ctx,
1319
1357
  @click.option('-c',
1320
1358
  '--cloudos-url',
1321
1359
  help=(f'The CloudOS url you are trying to access to. Default={CLOUDOS_URL}.'),
1322
- default=CLOUDOS_URL)
1360
+ default=CLOUDOS_URL,
1361
+ required=True)
1323
1362
  @click.option('--workspace-id',
1324
1363
  help='The specific CloudOS workspace id.',
1325
1364
  required=True)
@@ -1370,7 +1409,7 @@ def list_workflows(ctx,
1370
1409
  }
1371
1410
  # determine if the user provided all required parameters
1372
1411
  config_manager = ConfigurationProfile()
1373
- apikey, cloudos_url, workspace_id, workflow_name, repository_platform, execution_platform, project_name = (
1412
+ user_options = (
1374
1413
  config_manager.load_profile_and_validate_data(
1375
1414
  ctx,
1376
1415
  INIT_PROFILE,
@@ -1382,6 +1421,9 @@ def list_workflows(ctx,
1382
1421
  workspace_id=workspace_id
1383
1422
  )
1384
1423
  )
1424
+ apikey = user_options['apikey']
1425
+ cloudos_url = user_options['cloudos_url']
1426
+ workspace_id = user_options['workspace_id']
1385
1427
 
1386
1428
  verify_ssl = ssl_selector(disable_ssl_verification, ssl_cert)
1387
1429
  outfile = output_basename + '.' + output_format
@@ -1417,7 +1459,8 @@ def list_workflows(ctx,
1417
1459
  '--cloudos-url',
1418
1460
  help=('The CloudOS url you are trying to access to. ' +
1419
1461
  f'Default={CLOUDOS_URL}.'),
1420
- default=CLOUDOS_URL)
1462
+ default=CLOUDOS_URL,
1463
+ required=True)
1421
1464
  @click.option('--workspace-id',
1422
1465
  help='The specific CloudOS workspace id.',
1423
1466
  required=True)
@@ -1463,7 +1506,7 @@ def import_wf(ctx,
1463
1506
  }
1464
1507
  # determine if the user provided all required parameters
1465
1508
  config_manager = ConfigurationProfile()
1466
- apikey, cloudos_url, workspace_id, workflow_name, repository_platform, execution_platform, project_name = (
1509
+ user_options = (
1467
1510
  config_manager.load_profile_and_validate_data(
1468
1511
  ctx,
1469
1512
  INIT_PROFILE,
@@ -1477,6 +1520,11 @@ def import_wf(ctx,
1477
1520
  repository_platform=repository_platform
1478
1521
  )
1479
1522
  )
1523
+ apikey = user_options['apikey']
1524
+ cloudos_url = user_options['cloudos_url']
1525
+ workspace_id = user_options['workspace_id']
1526
+ workflow_name = user_options['workflow_name']
1527
+ repository_platform = user_options['repository_platform']
1480
1528
 
1481
1529
  verify_ssl = ssl_selector(disable_ssl_verification, ssl_cert)
1482
1530
  repo_import = ImportWorflow(
@@ -1497,7 +1545,8 @@ def import_wf(ctx,
1497
1545
  @click.option('-c',
1498
1546
  '--cloudos-url',
1499
1547
  help=(f'The CloudOS url you are trying to access to. Default={CLOUDOS_URL}.'),
1500
- default=CLOUDOS_URL)
1548
+ default=CLOUDOS_URL,
1549
+ required=True)
1501
1550
  @click.option('--workspace-id',
1502
1551
  help='The specific CloudOS workspace id.',
1503
1552
  required=True)
@@ -1553,7 +1602,7 @@ def list_projects(ctx,
1553
1602
  }
1554
1603
  # determine if the user provided all required parameters
1555
1604
  config_manager = ConfigurationProfile()
1556
- apikey, cloudos_url, workspace_id, workflow_name, repository_platform, execution_platform, project_name = (
1605
+ user_options = (
1557
1606
  config_manager.load_profile_and_validate_data(
1558
1607
  ctx,
1559
1608
  INIT_PROFILE,
@@ -1565,6 +1614,9 @@ def list_projects(ctx,
1565
1614
  workspace_id=workspace_id
1566
1615
  )
1567
1616
  )
1617
+ apikey = user_options['apikey']
1618
+ cloudos_url = user_options['cloudos_url']
1619
+ workspace_id = user_options['workspace_id']
1568
1620
 
1569
1621
  verify_ssl = ssl_selector(disable_ssl_verification, ssl_cert)
1570
1622
  outfile = output_basename + '.' + output_format
@@ -1619,7 +1671,8 @@ def list_projects(ctx,
1619
1671
  @click.option('-c',
1620
1672
  '--cloudos-url',
1621
1673
  help=(f'The CloudOS url you are trying to access to. Default={CLOUDOS_URL}.'),
1622
- default=CLOUDOS_URL)
1674
+ default=CLOUDOS_URL,
1675
+ required=True)
1623
1676
  @click.option('--workspace-id',
1624
1677
  help='The specific CloudOS workspace id.',
1625
1678
  required=True)
@@ -1654,7 +1707,7 @@ def cromwell_status(ctx,
1654
1707
  }
1655
1708
  # determine if the user provided all required parameters
1656
1709
  config_manager = ConfigurationProfile()
1657
- apikey, cloudos_url, workspace_id, workflow_name, repository_platform, execution_platform, project_name = (
1710
+ user_options = (
1658
1711
  config_manager.load_profile_and_validate_data(
1659
1712
  ctx,
1660
1713
  INIT_PROFILE,
@@ -1665,6 +1718,9 @@ def cromwell_status(ctx,
1665
1718
  workspace_id=workspace_id
1666
1719
  )
1667
1720
  )
1721
+ apikey = user_options['apikey']
1722
+ cloudos_url = user_options['cloudos_url']
1723
+ workspace_id = user_options['workspace_id']
1668
1724
 
1669
1725
  if apikey is None and cromwell_token is None:
1670
1726
  raise ValueError("Please, use one of the following tokens: '--apikey', '--cromwell_token'")
@@ -1694,7 +1750,8 @@ def cromwell_status(ctx,
1694
1750
  @click.option('-c',
1695
1751
  '--cloudos-url',
1696
1752
  help=(f'The CloudOS url you are trying to access to. Default={CLOUDOS_URL}.'),
1697
- default=CLOUDOS_URL)
1753
+ default=CLOUDOS_URL,
1754
+ required=True)
1698
1755
  @click.option('--workspace-id',
1699
1756
  help='The specific CloudOS workspace id.',
1700
1757
  required=True)
@@ -1734,7 +1791,7 @@ def cromwell_restart(ctx,
1734
1791
  }
1735
1792
  # determine if the user provided all required parameters
1736
1793
  config_manager = ConfigurationProfile()
1737
- apikey, cloudos_url, workspace_id, workflow_name, repository_platform, execution_platform, project_name = (
1794
+ user_options = (
1738
1795
  config_manager.load_profile_and_validate_data(
1739
1796
  ctx,
1740
1797
  INIT_PROFILE,
@@ -1745,6 +1802,9 @@ def cromwell_restart(ctx,
1745
1802
  workspace_id=workspace_id
1746
1803
  )
1747
1804
  )
1805
+ apikey = user_options['apikey']
1806
+ cloudos_url = user_options['cloudos_url']
1807
+ workspace_id = user_options['workspace_id']
1748
1808
 
1749
1809
  if apikey is None and cromwell_token is None:
1750
1810
  raise ValueError("Please, use one of the following tokens: '--apikey', '--cromwell_token'")
@@ -1796,7 +1856,8 @@ def cromwell_restart(ctx,
1796
1856
  @click.option('-c',
1797
1857
  '--cloudos-url',
1798
1858
  help=(f'The CloudOS url you are trying to access to. Default={CLOUDOS_URL}.'),
1799
- default=CLOUDOS_URL)
1859
+ default=CLOUDOS_URL,
1860
+ required=True)
1800
1861
  @click.option('--workspace-id',
1801
1862
  help='The specific CloudOS workspace id.',
1802
1863
  required=True)
@@ -1831,7 +1892,7 @@ def cromwell_stop(ctx,
1831
1892
  }
1832
1893
  # determine if the user provided all required parameters
1833
1894
  config_manager = ConfigurationProfile()
1834
- apikey, cloudos_url, workspace_id, workflow_name, repository_platform, execution_platform, project_name = (
1895
+ user_options = (
1835
1896
  config_manager.load_profile_and_validate_data(
1836
1897
  ctx,
1837
1898
  INIT_PROFILE,
@@ -1842,6 +1903,9 @@ def cromwell_stop(ctx,
1842
1903
  workspace_id=workspace_id
1843
1904
  )
1844
1905
  )
1906
+ apikey = user_options['apikey']
1907
+ cloudos_url = user_options['cloudos_url']
1908
+ workspace_id = user_options['workspace_id']
1845
1909
 
1846
1910
  if apikey is None and cromwell_token is None:
1847
1911
  raise ValueError("Please, use one of the following tokens: '--apikey', '--cromwell_token'")
@@ -1869,7 +1933,8 @@ def cromwell_stop(ctx,
1869
1933
  @click.option('-c',
1870
1934
  '--cloudos-url',
1871
1935
  help=(f'The CloudOS url you are trying to access to. Default={CLOUDOS_URL}.'),
1872
- default=CLOUDOS_URL)
1936
+ default=CLOUDOS_URL,
1937
+ required=True)
1873
1938
  @click.option('--workspace-id',
1874
1939
  help='The specific CloudOS workspace id.',
1875
1940
  required=True)
@@ -1916,7 +1981,7 @@ def list_queues(ctx,
1916
1981
  }
1917
1982
  # determine if the user provided all required parameters
1918
1983
  config_manager = ConfigurationProfile()
1919
- apikey, cloudos_url, workspace_id, workflow_name, repository_platform, execution_platform, project_name = (
1984
+ user_options = (
1920
1985
  config_manager.load_profile_and_validate_data(
1921
1986
  ctx,
1922
1987
  INIT_PROFILE,
@@ -1928,6 +1993,9 @@ def list_queues(ctx,
1928
1993
  workspace_id=workspace_id
1929
1994
  )
1930
1995
  )
1996
+ apikey = user_options['apikey']
1997
+ cloudos_url = user_options['cloudos_url']
1998
+ workspace_id = user_options['workspace_id']
1931
1999
 
1932
2000
  verify_ssl = ssl_selector(disable_ssl_verification, ssl_cert)
1933
2001
  outfile = output_basename + '.' + output_format
@@ -1977,7 +2045,8 @@ def remove_profile(ctx, profile):
1977
2045
  @click.option('-c',
1978
2046
  '--cloudos-url',
1979
2047
  help=(f'The CloudOS url you are trying to access to. Default={CLOUDOS_URL}.'),
1980
- default=CLOUDOS_URL)
2048
+ default=CLOUDOS_URL,
2049
+ required=True)
1981
2050
  @click.option('--workspace-id',
1982
2051
  help='The specific CloudOS workspace id.',
1983
2052
  required=True)
@@ -2098,7 +2167,7 @@ def run_bash_job(ctx,
2098
2167
 
2099
2168
  # determine if the user provided all required parameters
2100
2169
  config_manager = ConfigurationProfile()
2101
- apikey, cloudos_url, workspace_id, workflow_name, repository_platform, execution_platform, project_name = (
2170
+ user_options = (
2102
2171
  config_manager.load_profile_and_validate_data(
2103
2172
  ctx,
2104
2173
  INIT_PROFILE,
@@ -2114,6 +2183,13 @@ def run_bash_job(ctx,
2114
2183
  project_name=project_name
2115
2184
  )
2116
2185
  )
2186
+ apikey = user_options['apikey']
2187
+ cloudos_url = user_options['cloudos_url']
2188
+ workspace_id = user_options['workspace_id']
2189
+ workflow_name = user_options['workflow_name']
2190
+ repository_platform = user_options['repository_platform']
2191
+ execution_platform = user_options['execution_platform']
2192
+ project_name = user_options['project_name']
2117
2193
 
2118
2194
  verify_ssl = ssl_selector(disable_ssl_verification, ssl_cert)
2119
2195
 
@@ -2204,7 +2280,8 @@ def run_bash_job(ctx,
2204
2280
  @click.option('-c',
2205
2281
  '--cloudos-url',
2206
2282
  help=(f'The CloudOS url you are trying to access to. Default={CLOUDOS_URL}.'),
2207
- default=CLOUDOS_URL)
2283
+ default=CLOUDOS_URL,
2284
+ required=True)
2208
2285
  @click.option('--workspace-id',
2209
2286
  help='The specific CloudOS workspace id.',
2210
2287
  required=True)
@@ -2373,7 +2450,7 @@ def run_bash_array_job(ctx,
2373
2450
 
2374
2451
  # determine if the user provided all required parameters
2375
2452
  config_manager = ConfigurationProfile()
2376
- apikey, cloudos_url, workspace_id, workflow_name, repository_platform, execution_platform, project_name = (
2453
+ user_options = (
2377
2454
  config_manager.load_profile_and_validate_data(
2378
2455
  ctx,
2379
2456
  INIT_PROFILE,
@@ -2389,6 +2466,14 @@ def run_bash_array_job(ctx,
2389
2466
  project_name=project_name
2390
2467
  )
2391
2468
  )
2469
+ apikey = user_options['apikey']
2470
+ cloudos_url = user_options['cloudos_url']
2471
+ workspace_id = user_options['workspace_id']
2472
+ workflow_name = user_options['workflow_name']
2473
+ repository_platform = user_options['repository_platform']
2474
+ execution_platform = user_options['execution_platform']
2475
+ project_name = user_options['project_name']
2476
+
2392
2477
  verify_ssl = ssl_selector(disable_ssl_verification, ssl_cert)
2393
2478
 
2394
2479
  if not list_columns and not (command or custom_script_path):
@@ -2594,7 +2679,7 @@ def list_files(ctx,
2594
2679
  'project_name': False
2595
2680
  }
2596
2681
 
2597
- apikey, cloudos_url, workspace_id, workflow_name, repository_platform, execution_platform, project_name = (
2682
+ user_options = (
2598
2683
  config_manager.load_profile_and_validate_data(
2599
2684
  ctx,
2600
2685
  INIT_PROFILE,
@@ -2610,6 +2695,11 @@ def list_files(ctx,
2610
2695
  project_name=project_name
2611
2696
  )
2612
2697
  )
2698
+ # Setup only the required parameters
2699
+ apikey = user_options['apikey']
2700
+ cloudos_url = user_options['cloudos_url']
2701
+ workspace_id = user_options['workspace_id']
2702
+ project_name = user_options['project_name']
2613
2703
 
2614
2704
  verify_ssl = ssl_selector(disable_ssl_verification, ssl_cert)
2615
2705
 
@@ -2696,7 +2786,7 @@ def list_files(ctx,
2696
2786
  @click.argument("source_path", required=True)
2697
2787
  @click.argument("destination_path", required=True)
2698
2788
  @click.option('-k', '--apikey', required=True, help='Your CloudOS API key.')
2699
- @click.option('-c', '--cloudos-url', default=CLOUDOS_URL, required=False, help='The CloudOS URL.')
2789
+ @click.option('-c', '--cloudos-url', default=CLOUDOS_URL, required=True, help='The CloudOS URL.')
2700
2790
  @click.option('--workspace-id', required=True, help='The CloudOS workspace ID.')
2701
2791
  @click.option('--project-name', required=True, help='The source project name.')
2702
2792
  @click.option('--destination-project-name', required=False,
@@ -2736,7 +2826,7 @@ def move_files(ctx, source_path, destination_path, apikey, cloudos_url, workspac
2736
2826
  'project_name': True
2737
2827
  }
2738
2828
 
2739
- apikey, cloudos_url, workspace_id, workflow_name, repository_platform, execution_platform, project_name = (
2829
+ user_options = (
2740
2830
  config_manager.load_profile_and_validate_data(
2741
2831
  ctx,
2742
2832
  INIT_PROFILE,
@@ -2752,6 +2842,10 @@ def move_files(ctx, source_path, destination_path, apikey, cloudos_url, workspac
2752
2842
  project_name=project_name
2753
2843
  )
2754
2844
  )
2845
+ apikey = user_options['apikey']
2846
+ cloudos_url = user_options['cloudos_url']
2847
+ workspace_id = user_options['workspace_id']
2848
+ project_name = user_options['project_name']
2755
2849
 
2756
2850
  verify_ssl = ssl_selector(disable_ssl_verification, ssl_cert)
2757
2851
 
@@ -2880,7 +2974,7 @@ def renaming_item(ctx, source_path, new_name, apikey, cloudos_url,
2880
2974
  'project_name': True
2881
2975
  }
2882
2976
 
2883
- apikey, cloudos_url, workspace_id, workflow_name, repository_platform, execution_platform, project_name = (
2977
+ user_options = (
2884
2978
  config_manager.load_profile_and_validate_data(
2885
2979
  ctx,
2886
2980
  INIT_PROFILE,
@@ -2896,6 +2990,10 @@ def renaming_item(ctx, source_path, new_name, apikey, cloudos_url,
2896
2990
  project_name=project_name
2897
2991
  )
2898
2992
  )
2993
+ apikey = user_options['apikey']
2994
+ cloudos_url = user_options['cloudos_url']
2995
+ workspace_id = user_options['workspace_id']
2996
+ project_name = user_options['project_name']
2899
2997
 
2900
2998
  verify_ssl = ssl_selector(disable_ssl_verification, ssl_cert)
2901
2999
  # Initialize Datasets clients
@@ -2984,7 +3082,7 @@ def copy_item_cli(ctx, source_path, destination_path, apikey, cloudos_url,
2984
3082
  'workflow_name': False,
2985
3083
  'project_name': True
2986
3084
  }
2987
- apikey, cloudos_url, workspace_id, workflow_name, _, _, project_name = config_manager.load_profile_and_validate_data(
3085
+ user_options = config_manager.load_profile_and_validate_data(
2988
3086
  ctx, INIT_PROFILE, CLOUDOS_URL, profile=profile,
2989
3087
  required_dict=required_dict,
2990
3088
  apikey=apikey,
@@ -2995,6 +3093,11 @@ def copy_item_cli(ctx, source_path, destination_path, apikey, cloudos_url,
2995
3093
  execution_platform=None,
2996
3094
  project_name=project_name
2997
3095
  )
3096
+ apikey = user_options['apikey']
3097
+ cloudos_url = user_options['cloudos_url']
3098
+ workspace_id = user_options['workspace_id']
3099
+ project_name = user_options['project_name']
3100
+
2998
3101
  destination_project_name = destination_project_name or project_name
2999
3102
  verify_ssl = ssl_selector(disable_ssl_verification, ssl_cert)
3000
3103
  # Initialize clients
@@ -3120,7 +3223,7 @@ def mkdir_item(ctx, new_folder_path, apikey, cloudos_url,
3120
3223
  'project_name': True
3121
3224
  }
3122
3225
 
3123
- apikey, cloudos_url, workspace_id, workflow_name, repository_platform, execution_platform, project_name = (
3226
+ user_options = (
3124
3227
  config_manager.load_profile_and_validate_data(
3125
3228
  ctx,
3126
3229
  INIT_PROFILE,
@@ -3136,6 +3239,10 @@ def mkdir_item(ctx, new_folder_path, apikey, cloudos_url,
3136
3239
  project_name=project_name
3137
3240
  )
3138
3241
  )
3242
+ apikey = user_options['apikey']
3243
+ cloudos_url = user_options['cloudos_url']
3244
+ workspace_id = user_options['workspace_id']
3245
+ project_name = user_options['project_name']
3139
3246
 
3140
3247
  verify_ssl = ssl_selector(disable_ssl_verification, ssl_cert)
3141
3248
 
@@ -3226,7 +3333,7 @@ def rm_item(ctx, target_path, apikey, cloudos_url,
3226
3333
  'project_name': True
3227
3334
  }
3228
3335
 
3229
- apikey, cloudos_url, workspace_id, workflow_name, repository_platform, execution_platform, project_name = (
3336
+ user_options = (
3230
3337
  config_manager.load_profile_and_validate_data(
3231
3338
  ctx,
3232
3339
  INIT_PROFILE,
@@ -3242,6 +3349,10 @@ def rm_item(ctx, target_path, apikey, cloudos_url,
3242
3349
  project_name=project_name
3243
3350
  )
3244
3351
  )
3352
+ apikey = user_options['apikey']
3353
+ cloudos_url = user_options['cloudos_url']
3354
+ workspace_id = user_options['workspace_id']
3355
+ project_name = user_options['project_name']
3245
3356
 
3246
3357
  verify_ssl = ssl_selector(disable_ssl_verification, ssl_cert)
3247
3358
 
@@ -3294,5 +3405,67 @@ def rm_item(ctx, target_path, apikey, cloudos_url,
3294
3405
  sys.exit(1)
3295
3406
 
3296
3407
 
3408
+ @datasets.command(name="link")
3409
+ @click.argument("s3_path", required=True)
3410
+ @click.option('-k', '--apikey', help='Your CloudOS API key', required=True)
3411
+ @click.option('-c', '--cloudos-url',
3412
+ help=(f'The CloudOS url you are trying to access to. Default={CLOUDOS_URL}.'),
3413
+ default=CLOUDOS_URL)
3414
+ @click.option('--workspace-id', help='The specific CloudOS workspace id.', required=True)
3415
+ @click.option('--session-id', help='The specific CloudOS interactive session id.', required=True)
3416
+ @click.option('--disable-ssl-verification', is_flag=True, help='Disable SSL certificate verification.')
3417
+ @click.option('--ssl-cert', help='Path to your SSL certificate file.')
3418
+ @click.option('--profile', help='Profile to use from the config file', default='default')
3419
+ @click.pass_context
3420
+ def link(ctx, s3_path, apikey, cloudos_url, workspace_id, session_id, disable_ssl_verification, ssl_cert, profile):
3421
+ """
3422
+ Link a S3 folder to an active interactive analysis.
3423
+
3424
+ S3_PATH [path]: the full path to the S3 folder to link. E.g.: 's3://bucket-name/folder/subfolder'\n
3425
+ """
3426
+ print(link.__doc__ + '\n')
3427
+
3428
+ profile = profile or ctx.default_map['datasets']['link']['profile']
3429
+
3430
+ # Create a dictionary with required and non-required params
3431
+ required_dict = {
3432
+ 'apikey': True,
3433
+ 'workspace_id': True,
3434
+ 'workflow_name': False,
3435
+ 'project_name': False
3436
+ }
3437
+ # determine if the user provided all required parameters
3438
+ config_manager = ConfigurationProfile()
3439
+ user_options = (
3440
+ config_manager.load_profile_and_validate_data(
3441
+ ctx,
3442
+ INIT_PROFILE,
3443
+ CLOUDOS_URL,
3444
+ profile=profile,
3445
+ required_dict=required_dict,
3446
+ apikey=apikey,
3447
+ cloudos_url=cloudos_url,
3448
+ workspace_id=workspace_id,
3449
+ session_id=session_id
3450
+ )
3451
+ )
3452
+ # Unpack the user options
3453
+ apikey = user_options['apikey']
3454
+ cloudos_url = user_options['cloudos_url']
3455
+ workspace_id = user_options['workspace_id']
3456
+ session_id = user_options['session_id']
3457
+
3458
+ verify_ssl = ssl_selector(disable_ssl_verification, ssl_cert)
3459
+ link_p = Link(
3460
+ cloudos_url=cloudos_url,
3461
+ apikey=apikey,
3462
+ workspace_id=workspace_id,
3463
+ cromwell_token=None,
3464
+ project_name=None,
3465
+ verify=verify_ssl
3466
+ )
3467
+ link_p.link_S3_folder(s3_path, session_id)
3468
+
3469
+
3297
3470
  if __name__ == "__main__":
3298
3471
  run_cloudos_cli()
@@ -0,0 +1 @@
1
+ __version__ = '2.38.0'
@@ -68,6 +68,7 @@ class ConfigurationProfile:
68
68
  shared_config['workflow_name'] = profile_data.get('workflow_name', None)
69
69
  shared_config['repository_platform'] = profile_data.get('repository_platform', None)
70
70
  shared_config['execution_platform'] = profile_data.get('execution_platform', None)
71
+ shared_config['session_id'] = profile_data.get('session_id', None)
71
72
  shared_config['profile'] = profile_name
72
73
  print(f"Profile '{profile_name}' already exists. You can update single parameters or all.")
73
74
 
@@ -183,6 +184,18 @@ class ConfigurationProfile:
183
184
  else:
184
185
  workflow_name = workflow_name
185
186
 
187
+ # Interactive Analysis ID
188
+ session_id = input(
189
+ f"Interactive Analysis ID [{shared_config.get('session_id', profile_name)}]: "
190
+ ).strip()
191
+ # If the user presses Enter, keep the existing value
192
+ if session_id == "" and shared_config.get('session_id', None) is not None:
193
+ session_id = shared_config['session_id']
194
+ elif session_id == "":
195
+ session_id = None
196
+ else:
197
+ session_id = session_id
198
+
186
199
  # Make the profile the default if it is the first one
187
200
  if number_of_profiles >= 1:
188
201
  default_profile = self.determine_default_profile()
@@ -227,6 +240,9 @@ class ConfigurationProfile:
227
240
  config[profile_name]['workflow_name'] = workflow_name
228
241
  if default_profile is not None:
229
242
  config[profile_name]['default'] = str(default_profile)
243
+ if session_id is not None:
244
+ config[profile_name]['session_id'] = session_id
245
+
230
246
 
231
247
  with open(self.config_file, 'w') as conf_file:
232
248
  config.write(conf_file)
@@ -360,6 +376,7 @@ class ConfigurationProfile:
360
376
  'workflow_name': config[profile_name].get('workflow_name', ""),
361
377
  'execution_platform': config[profile_name].get('execution_platform', ""),
362
378
  'repository_platform': config[profile_name].get('repository_platform', ""),
379
+ 'session_id': config[profile_name].get('session_id', "")
363
380
  }
364
381
 
365
382
  def check_if_profile_exists(self, profile_name):
@@ -427,7 +444,7 @@ class ConfigurationProfile:
427
444
 
428
445
  def load_profile_and_validate_data(self, ctx, init_profile, cloudos_url_default, profile, required_dict, apikey=None,
429
446
  cloudos_url=None, workspace_id=None, project_name=None, workflow_name=None,
430
- execution_platform=None, repository_platform=None):
447
+ execution_platform=None, repository_platform=None, session_id=None):
431
448
  """
432
449
  Load profile data and validate required parameters.
433
450
 
@@ -443,7 +460,7 @@ class ConfigurationProfile:
443
460
  The profile name to load.
444
461
  required_dict : dict
445
462
  A dictionary with param name as key and whether is required or not (as bool) as value.
446
- apikey, cloudos_url, workspace_id, project_name, workflow_name, execution_platform, repository_platform : string
463
+ apikey, cloudos_url, workspace_id, project_name, workflow_name, execution_platform, repository_platform, session_id : string
447
464
  The values coming from the CLI to be compared with the profile
448
465
 
449
466
  Returns
@@ -457,8 +474,7 @@ class ConfigurationProfile:
457
474
  profile_data = self.load_profile(profile_name=profile)
458
475
  apikey = self.get_param_value(ctx, apikey, 'apikey', profile_data['apikey'],
459
476
  required=required_dict['apikey'], missing_required_params=missing)
460
- cloudos_url = self.get_param_value(ctx, cloudos_url, 'cloudos_url',
461
- profile_data['cloudos_url']) or cloudos_url_default
477
+ resolved_cloudos_url = self.get_param_value(ctx, cloudos_url, 'cloudos_url', profile_data['cloudos_url'])
462
478
  workspace_id = self.get_param_value(ctx, workspace_id, 'workspace_id', profile_data['workspace_id'],
463
479
  required=required_dict['workspace_id'], missing_required_params=missing)
464
480
  workflow_name = self.get_param_value(ctx, workflow_name, 'workflow_name', profile_data['workflow_name'],
@@ -469,11 +485,13 @@ class ConfigurationProfile:
469
485
  profile_data['execution_platform'])
470
486
  project_name = self.get_param_value(ctx, project_name, 'project_name', profile_data['project_name'],
471
487
  required=required_dict['project_name'], missing_required_params=missing)
488
+ session_id = self.get_param_value(ctx, session_id, 'session_id', profile_data.get('session_id', None))
472
489
  else:
473
490
  # when no profile is used, we need to check if the user provided all required parameters
474
491
  apikey = self.get_param_value(ctx, apikey, 'apikey', apikey, required=required_dict['apikey'],
475
492
  missing_required_params=missing)
476
- cloudos_url = self.get_param_value(ctx, cloudos_url, 'cloudos_url', cloudos_url) or cloudos_url_default
493
+ resolved_cloudos_url = self.get_param_value(ctx, cloudos_url, 'cloudos_url', cloudos_url,
494
+ missing_required_params=missing)
477
495
  workspace_id = self.get_param_value(ctx, workspace_id, 'workspace_id', workspace_id,
478
496
  required=required_dict['workspace_id'],
479
497
  missing_required_params=missing)
@@ -486,10 +504,29 @@ class ConfigurationProfile:
486
504
  project_name = self.get_param_value(ctx, project_name, 'project_name', project_name,
487
505
  required=required_dict['project_name'],
488
506
  missing_required_params=missing)
507
+ session_id = self.get_param_value(ctx, session_id, 'session_id', session_id)
508
+ if not resolved_cloudos_url:
509
+ click.secho(
510
+ f"[Warning] No CloudOS URL provided via CLI or profile. Falling back to default: {cloudos_url_default}",
511
+ fg="yellow",
512
+ bold=True
513
+ )
514
+ cloudos_url = cloudos_url_default
515
+ else:
516
+ cloudos_url = resolved_cloudos_url
489
517
  cloudos_url = cloudos_url.rstrip('/')
490
518
 
491
519
  # Raise once, after all checks
492
520
  if missing:
493
521
  formatted = ', '.join(p for p in missing)
494
- raise click.UsageError(f"Missing required option/s: {formatted}")
495
- return apikey, cloudos_url, workspace_id, workflow_name, repository_platform, execution_platform, project_name
522
+ raise click.UsageError(f"Missing required option/s: {formatted} \nYou can configure the following parameters persistently by running cloudos configure:\n --apikey,\n --cloudos-url,\n --workspace-id,\n --workflow-name,\n --repository-platform,\n --execution-platform,\n --project-name\n For more information on the usage of the command, please run cloudos configure --help")
523
+ return {
524
+ 'apikey': apikey,
525
+ 'cloudos_url': cloudos_url,
526
+ 'workspace_id': workspace_id,
527
+ 'workflow_name': workflow_name,
528
+ 'repository_platform': repository_platform,
529
+ 'execution_platform': execution_platform,
530
+ 'project_name': project_name,
531
+ 'session_id': session_id
532
+ }
@@ -0,0 +1,8 @@
1
+ """
2
+ Functions and classes related to datasets.
3
+ """
4
+
5
+ from .link import Link
6
+
7
+
8
+ __all__ = ['link']
@@ -0,0 +1,125 @@
1
+ """
2
+ This is the main class for linking files to interactive sessions.
3
+ """
4
+
5
+ from dataclasses import dataclass
6
+ from typing import Union
7
+ from cloudos_cli.clos import Cloudos
8
+ from cloudos_cli.utils.requests import retry_requests_post
9
+ from urllib.parse import urlparse
10
+
11
+
12
+ @dataclass
13
+ class Link(Cloudos):
14
+ """Class for linking folders/files to interactive sessions.
15
+
16
+ Parameters
17
+ ----------
18
+ cloudos_url : string
19
+ The CloudOS service url.
20
+ apikey : string
21
+ Your CloudOS API key.
22
+ workspace_id : string
23
+ The specific Cloudos workspace id.
24
+ verify: [bool|string]
25
+ Whether to use SSL verification or not. Alternatively, if
26
+ a string is passed, it will be interpreted as the path to
27
+ the SSL certificate file.
28
+ """
29
+ workspace_id: str
30
+ project_name: str
31
+ verify: Union[bool, str] = True
32
+
33
+ def link_S3_folder(self,
34
+ s3_folder: str,
35
+ session_id: str) -> dict:
36
+ """Link an S3 folder to an interactive session.
37
+
38
+ Parameters
39
+ ----------
40
+ s3_folder : str
41
+ The S3 folder to link.
42
+ session_id : str
43
+ The interactive session ID.
44
+
45
+ Raises
46
+ ------
47
+ ValueError
48
+ If the S3 URL already exists with 'mounted' status
49
+ If the API key is invalid or permissions are insufficient
50
+ If the S3 URL is invalid or the session is not active.
51
+ """
52
+ url = (
53
+ f"{self.cloudos_url}/api/v1/"
54
+ f"interactive-sessions/{session_id}/fuse-filesystem/mount"
55
+ f"?teamId={self.workspace_id}"
56
+ )
57
+ headers = {
58
+ "Content-type": "application/json",
59
+ "apikey": self.apikey
60
+ }
61
+ data = self.parse_s3_path(s3_folder)
62
+ r = retry_requests_post(url, headers=headers, json=data, verify=self.verify)
63
+
64
+ if r.status_code == 403:
65
+ raise ValueError(f"Provided folder already exists with 'mounted' status")
66
+ elif r.status_code == 401:
67
+ raise ValueError(f"Forbidden: Invalid API key or insufficient permissions")
68
+ elif r.status_code == 400:
69
+ raise ValueError("Bad request: please make sure the S3 URL is valid, and the session is active")
70
+ elif r.status_code == 204:
71
+ full_path = (
72
+ f"s3://{data['dataItem']['data']['s3BucketName']}/"
73
+ f"{data['dataItem']['data']['s3Prefix']}"
74
+ )
75
+ print(f"Succesfully linked S3 folder: {full_path}")
76
+
77
+
78
+ def parse_s3_path(self, s3_url):
79
+ """
80
+ Parses an S3 URL and extracts the bucket name, prefix, and base name.
81
+
82
+ Parameters
83
+ ----------
84
+ s3_url : str
85
+ The S3 URL to parse. Must start with "s3://".
86
+
87
+ Returns
88
+ -------
89
+ dict: A dictionary containing the parsed S3 information structured as:
90
+ "dataItem": {
91
+ "type": "S3Folder",
92
+ "data": {
93
+ "name": str, # The base name (last segment of the prefix).
94
+ "s3BucketName": str, # The name of the S3 bucket.
95
+ "s3Prefix": str # The full prefix path in the bucket.
96
+
97
+ Raises
98
+ ------
99
+ ValueError
100
+ If the S3 URL does not start with "s3://".
101
+ If the S3 URL does not include a key after the bucket.
102
+ """
103
+ if not s3_url.startswith("s3://"):
104
+ raise ValueError("Invalid S3 URL. Link must start with 's3://'")
105
+
106
+ parsed = urlparse(s3_url)
107
+ bucket = parsed.netloc
108
+ prefix = parsed.path.lstrip('/') # Remove leading slash
109
+
110
+ if not prefix:
111
+ raise ValueError("S3 URL must include a key after the bucket")
112
+
113
+ parts = prefix.rstrip('/').split('/')
114
+ base = parts[-1] # Last segment (file or folder)
115
+ return {
116
+ "dataItem": {
117
+ "type": "S3Folder",
118
+ "data": {
119
+ "name": base,
120
+ "s3BucketName": bucket,
121
+ "s3Prefix": prefix
122
+ }
123
+ }
124
+ }
125
+
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cloudos_cli
3
- Version: 2.37.0
3
+ Version: 2.38.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
@@ -106,7 +106,7 @@ In order to generate a profile called `default`, the following command can be us
106
106
  cloudos configure
107
107
  ```
108
108
 
109
- This will bring in prompts for API, platform URL, project name, platform executor, repository provider, workflow name (if any). This will be the default profile if no other was explicitly set. The default profile allows running all subcommands without adding `--profile` option in the command line.
109
+ This will bring in prompts for API, platform URL, project name, platform executor, repository provider, workflow name (if any) and session ID for interactive analysis. This will be the default profile if no other was explicitly set. The default profile allows running all subcommands without adding `--profile` option in the command line.
110
110
 
111
111
  ### Configure named profile
112
112
 
@@ -1089,6 +1089,32 @@ Please, note that in the above example a preconfigured profile has been used. If
1089
1089
  --project-name $PROJEC_NAME
1090
1090
  ```
1091
1091
 
1092
+ #### Linking S3 folders to Interactive Analysis
1093
+
1094
+ The CLI can link S3 folders into an interactive session, which will appear in the left panel of the session as "mounted". This subcommand is using the option `--session-id` to access the correct interactive session. This option can be added to the CLI or defined in a profile, for convenience.
1095
+
1096
+ The usage of the subcommand is as follows:
1097
+
1098
+ ```console
1099
+ cloudos datasets link <S3 FOLDER COMPLETE PATH> <options>
1100
+ ```
1101
+
1102
+ For example:
1103
+
1104
+ ```console
1105
+ cloudos datasets link s3://bucket/path/folder --profile test
1106
+ ```
1107
+ where profile `test` has already defined the `--session-id`.
1108
+
1109
+ Or specifying explicitly:
1110
+
1111
+ ```console
1112
+ cloudos datasets link s3://bucket/path/folder --profile test --session-id 1234
1113
+ ```
1114
+ where profile `test` is used for all other necessary variables, but `--session-id` is overwritten from the command line.
1115
+
1116
+ > [!NOTE]
1117
+ > If running the CLI inside a jupyter session, the pre-configured CLI installation will have the session ID already installed and only the `--apikey` needs to be added.
1092
1118
 
1093
1119
  #### Create a (virtual) folder
1094
1120
 
@@ -19,6 +19,8 @@ cloudos_cli/import_wf/__init__.py
19
19
  cloudos_cli/import_wf/import_wf.py
20
20
  cloudos_cli/jobs/__init__.py
21
21
  cloudos_cli/jobs/job.py
22
+ cloudos_cli/link/__init__.py
23
+ cloudos_cli/link/link.py
22
24
  cloudos_cli/queue/__init__.py
23
25
  cloudos_cli/queue/queue.py
24
26
  cloudos_cli/utils/__init__.py
@@ -1 +0,0 @@
1
- __version__ = '2.37.0'
File without changes
File without changes
File without changes