Skip to content

Commit e527a92

Browse files
patch: clean main (#291)
* refactor: move functionality from main file * test: update imports * docs: updage changes and version * refactor: jobs * refactor: update missing code * refactor: link * ci: add run and abort * ci: adds job resume * ci: adds configure tests * ci: adds configure tests + workdir --delete * ci: remove typo duplicate * ci: update resume option * ci: refactor to not have hardcoded jobs * ci: update job_workdir, job_resume to run before delete_workdir * ci: add job id dependency * refactor: remove unsed files * ci: change dependency for workdir --delete * ci: update workdir --delete * ci: update resume * ci: update resume * update wait completion * update resume job id * ci: update resume output * review: add debug to all commands * review: resolve Leila's conversations * review: add python versions 3.9, 3.11, 3.15 for all the tests * review: change latest supported python versions 3.13 for all the tests * review: use exit 1 * review: moved imports at the top * Update CHANGELOG.md Co-authored-by: dapineyro <45285897+dapineyro@users.noreply.github.com> * Update cloudos_cli/_version.py Co-authored-by: dapineyro <45285897+dapineyro@users.noreply.github.com> * revert: use python 3.9 only for now in platform tests * refactor: add missing variable * ci: update versions * refactor: add constants in own file * ci: filter by default queue * ci: fix intermittent failure * refactor: remove unused interpolations * style: remove whitespaces * style: remove whitespaces * ci: temporarily disable filter-queue --------- Co-authored-by: dapineyro <45285897+dapineyro@users.noreply.github.com>
1 parent ac41ff2 commit e527a92

54 files changed

Lines changed: 5260 additions & 4908 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 217 additions & 41 deletions
Large diffs are not rendered by default.

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
## lifebit-ai/cloudos-cli: changelog
22

3+
## v2.79.0 (2026-01-28)
4+
5+
### Patch
6+
7+
- Refactor `__main__.py` to move commands into separate files for better organization
8+
- Improve CI/CD pipeline to test additional functionalities and use dynamically generated job IDs from tests instead of predefined values
9+
310
## v2.78.0 (2026-01-13)
411

512
### Feat

cloudos_cli/__main__.py

Lines changed: 36 additions & 4335 deletions
Large diffs are not rendered by default.

cloudos_cli/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '2.78.0'
1+
__version__ = '2.79.0'

cloudos_cli/bash/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"""Bash job-related CLI commands."""

cloudos_cli/bash/cli.py

Lines changed: 566 additions & 0 deletions
Large diffs are not rendered by default.

cloudos_cli/clos.py

Lines changed: 72 additions & 78 deletions
Large diffs are not rendered by default.

cloudos_cli/configure/cli.py

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
"""CLI commands for CloudOS configuration management."""
2+
3+
import rich_click as click
4+
from cloudos_cli.configure.configure import ConfigurationProfile
5+
from cloudos_cli.logging.logger import update_command_context_from_click
6+
from cloudos_cli.utils.cli_helpers import pass_debug_to_subcommands
7+
8+
9+
# Create the configure group
10+
@click.group(cls=pass_debug_to_subcommands(), invoke_without_command=True)
11+
@click.option('--profile', help='Profile to use from the config file', default='default')
12+
@click.option('--make-default',
13+
is_flag=True,
14+
help='Make the profile the default one.')
15+
@click.pass_context
16+
def configure(ctx, profile, make_default):
17+
"""CloudOS configuration."""
18+
print(configure.__doc__ + '\n')
19+
update_command_context_from_click(ctx)
20+
profile = profile or ctx.obj['profile']
21+
config_manager = ConfigurationProfile()
22+
23+
if ctx.invoked_subcommand is None and profile == "default" and not make_default:
24+
config_manager.create_profile_from_input(profile_name="default")
25+
26+
if profile != "default" and not make_default:
27+
config_manager.create_profile_from_input(profile_name=profile)
28+
if make_default:
29+
config_manager.make_default_profile(profile_name=profile)
30+
31+
32+
@configure.command('list-profiles')
33+
def list_profiles():
34+
"""List all available configuration profiles."""
35+
config_manager = ConfigurationProfile()
36+
config_manager.list_profiles()
37+
38+
39+
@configure.command('remove-profile')
40+
@click.option('--profile',
41+
help='Name of the profile. Not using this option will lead to profile named "deafults" being generated',
42+
required=True)
43+
@click.pass_context
44+
def remove_profile(ctx, profile):
45+
"""Remove a configuration profile."""
46+
update_command_context_from_click(ctx)
47+
profile = profile or ctx.obj['profile']
48+
config_manager = ConfigurationProfile()
49+
config_manager.remove_profile(profile)

cloudos_cli/configure/configure.py

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import configparser
44
import click
55
from cloudos_cli.logging.logger import update_command_context_from_click
6+
from cloudos_cli.constants import CLOUDOS_URL, INIT_PROFILE
67

78

89
class ConfigurationProfile:
@@ -257,7 +258,7 @@ def create_profile_from_input(self, profile_name):
257258
config[profile_name]['default'] = str(default_profile)
258259
if session_id is not None:
259260
config[profile_name]['session_id'] = session_id
260-
261+
261262

262263
with open(self.config_file, 'w') as conf_file:
263264
config.write(conf_file)
@@ -361,10 +362,10 @@ def make_default_profile(self, profile_name):
361362

362363
def load_profile(self, profile_name):
363364
"""Load a profile from the config and credentials files dynamically.
364-
365+
365366
This method now returns ALL parameters from the profile, not just predefined ones.
366367
This makes it extensible - you can add new parameters to profiles without modifying this method.
367-
368+
368369
Parameters:
369370
----------
370371
profile_name : str
@@ -374,12 +375,12 @@ def load_profile(self, profile_name):
374375
dict
375376
A dictionary containing all profile parameters. Returns all keys from both
376377
credentials and config files for the specified profile.
377-
378+
378379
Examples
379380
--------
380381
# If you add accelerate_saving_results to your profile config:
381382
config[profile_name]['accelerate_saving_results'] = 'true'
382-
383+
383384
# It will automatically be included in the returned dictionary:
384385
profile_data = load_profile('myprofile')
385386
# profile_data will contain 'accelerate_saving_results': 'true'
@@ -399,19 +400,19 @@ def load_profile(self, profile_name):
399400

400401
# Dynamically load all parameters from the profile
401402
profile_data = {}
402-
403+
403404
# Load all items from credentials file
404405
if credentials.has_section(profile_name):
405406
for key, value in credentials[profile_name].items():
406407
profile_data[key] = value
407-
408+
408409
# Load all items from config file
409410
if config.has_section(profile_name):
410411
for key, value in config[profile_name].items():
411412
# Skip the 'default' flag as it's not a user parameter
412413
if key != 'default':
413414
profile_data[key] = value
414-
415+
415416
return profile_data
416417

417418
def check_if_profile_exists(self, profile_name):
@@ -480,7 +481,7 @@ def get_param_value(ctx, param_value, param_name, default_value, required=False,
480481
def load_profile_and_validate_data(self, ctx, init_profile, cloudos_url_default, profile, required_dict, **cli_params):
481482
"""
482483
Load profile data and validate required parameters dynamically.
483-
484+
484485
This method now accepts any parameters via **cli_params, making it extensible.
485486
You can add new parameters to profiles (like accelerate_saving_results) without
486487
modifying this method.
@@ -500,7 +501,7 @@ def load_profile_and_validate_data(self, ctx, init_profile, cloudos_url_default,
500501
**cli_params : dict
501502
All CLI parameters passed as keyword arguments. Any parameter can be passed here
502503
and will be resolved from the profile if available.
503-
504+
504505
Examples: apikey, cloudos_url, workspace_id, project_name, workflow_name,
505506
execution_platform, repository_platform, session_id, procurement_id,
506507
accelerate_saving_results, etc.
@@ -509,7 +510,7 @@ def load_profile_and_validate_data(self, ctx, init_profile, cloudos_url_default,
509510
-------
510511
dict
511512
A dictionary containing all loaded and validated parameters.
512-
513+
513514
Examples
514515
--------
515516
# Add a new parameter to profile without changing this method:
@@ -524,7 +525,7 @@ def load_profile_and_validate_data(self, ctx, init_profile, cloudos_url_default,
524525
if profile != init_profile:
525526
# Load profile data
526527
profile_data = self.load_profile(profile_name=profile)
527-
528+
528529
# Dynamically process all parameters passed in cli_params
529530
for param_name, cli_value in cli_params.items():
530531
profile_value = profile_data.get(param_name, "")
@@ -539,7 +540,7 @@ def load_profile_and_validate_data(self, ctx, init_profile, cloudos_url_default,
539540
required=is_required,
540541
missing_required_params=missing
541542
)
542-
543+
543544
# Convert empty strings to None for optional parameters
544545
# This prevents issues with functions that expect None for unset values
545546
if resolved_value == "" and not is_required:
@@ -592,11 +593,6 @@ def load_profile_and_validate_data(self, ctx, init_profile, cloudos_url_default,
592593
return resolved_params
593594

594595

595-
# Not part of the class, but related to configuration
596-
# Global constants for CloudOS CLI
597-
CLOUDOS_URL = 'https://cloudos.lifebit.ai'
598-
INIT_PROFILE = 'initialisingProfile'
599-
600596
# Define all standard configuration keys with their default empty values
601597
# This is the single source of truth for configuration fields
602598
STANDARD_CONFIG_KEYS = {

cloudos_cli/constants.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
"""Global constants for CloudOS CLI."""
2+
3+
# Job status constants
4+
JOB_COMPLETED = 'completed'
5+
JOB_FAILED = 'failed'
6+
JOB_ABORTED = 'aborted'
7+
8+
# Nextflow version constants
9+
AWS_NEXTFLOW_VERSIONS = ['22.10.8', '24.04.4']
10+
AZURE_NEXTFLOW_VERSIONS = ['22.11.1-edge']
11+
HPC_NEXTFLOW_VERSIONS = ['22.10.8']
12+
AWS_NEXTFLOW_LATEST = '24.04.4'
13+
AZURE_NEXTFLOW_LATEST = '22.11.1-edge'
14+
HPC_NEXTFLOW_LATEST = '22.10.8'
15+
16+
# Job abort states
17+
ABORT_JOB_STATES = ['running', 'initializing']
18+
19+
# Request interval for Cromwell
20+
REQUEST_INTERVAL_CROMWELL = 30
21+
22+
# Global constants for CloudOS CLI
23+
CLOUDOS_URL = 'https://cloudos.lifebit.ai'
24+
INIT_PROFILE = 'initialisingProfile'

0 commit comments

Comments
 (0)