Skip to content

Feat: Adds interactive session creation and listing#300

Open
l-mansouri wants to merge 32 commits intomainfrom
ia_sessions
Open

Feat: Adds interactive session creation and listing#300
l-mansouri wants to merge 32 commits intomainfrom
ia_sessions

Conversation

@l-mansouri
Copy link
Collaborator

@l-mansouri l-mansouri commented Mar 18, 2026

Overview

This PR implements the first two commands of the interactive session module of the CLI: list and create.

JIRA

Please add here as many related tasks this PR covers with its brief description, if more than one ticket

Changes

  • Implements the interactive-session module
  • Implements the listing of interactive session
  • Implements the creation of interactive session
  • Refactors the documentation to add the new implemented module and commands

Acceptance Criteria

This acceptance criteria is tested in ADAPT workspace in PROD using the default profile

LISTING

Screenshot 2026-03-18 at 11 03 55
Scenario 1: Successfully list all IA sessions in the workspace
cloudos interactive-session list
Screenshot 2026-03-18 at 11 04 14
Scenario 2: Listed sessions can report the same information as the platform UI
cloudos interactive-session list --table-columns status,name,owner,project,created_at,runtime,saved_at,cost,resources,backend,version
Screenshot 2026-03-18 at 12 12 39
Scenario 3: User can retrieve a specific page of results by providing page number and page-size
cloudos interactive-session list --page 3 --limit 5
Screenshot 2026-03-18 at 11 27 20
Scenario 4: User can navigate through pages interactively using the terminal
cloudos interactive-session list
Screen.Recording.2026-03-18.at.12.13.37.mov
Scenario 5: Attempt to list IA sessions with invalid credentials
cloudos interactive-session list --apikey invalid_key 
Screenshot 2026-03-18 at 12 24 29
Scenario 6: User can filter sessions by status
# Filter by setup status
cloudos interactive-session list --filter-status setup

# Filter by initialising status
cloudos interactive-session list --filter-status initialising

# Filter by running status
cloudos interactive-session list --filter-status running

# Filter by stopped status
cloudos interactive-session list --filter-status stopped
Screenshot 2026-03-18 at 11 27 00
Scenario 7: User can filter to display only their own sessions
cloudos interactive-session list --filter-owner-only
Screenshot 2026-03-18 at 11 27 43
Scenario 8: User can view archived sessions
cloudos interactive-session list --archived
Screenshot 2026-03-18 at 11 28 02
Scenario 9: User can export session list in CSV format
# Export with default filename
cloudos interactive-session list --output-format csv

# Export with custom filename and all fields
cloudos interactive-session list --output-format csv --all-fields --output-basename my_sessions
Screenshot 2026-03-18 at 12 27 36
Scenario 10: User can export session list in JSON format
cloudos interactive-session list --output-format json
Screenshot 2026-03-18 at 11 29 41
Scenario 11: User can select specific columns to display in the table output
cloudos interactive-session list --table-columns id,name,status,type,instance,cost,owner
Screenshot 2026-03-18 at 11 30 09
AZURE LISTING
cloudos interactive-session list --profile azure-prod
Screenshot 2026-03-18 at 17 01 16

CREATING

Screenshot 2026-03-18 at 15 46 09
Scenario 1: Successfully create a new Jupyter IA session
cloudos interactive-session create --session-type jupyter --name test_jupyter
Screenshot 2026-03-18 at 14 33 44
Scenario 2: Successfully create a new VSCode IA session
cloudos interactive-session create --session-type vscode --name test_vs
Screenshot 2026-03-18 at 14 45 07
Scenario 3: Successfully create a new RStudio IA session
cloudos interactive-session create --session-type rstudio --name test_rstudio
Screenshot 2026-03-18 at 14 46 01
Scenario 4: Successfully create a new Spark IA session
cloudos interactive-session create --session-type spark --name test_spark
Screenshot 2026-03-18 at 14 46 42
Scenario 5: Create a new IA session with custom instance type
cloudos interactive-session create --session-type jupyter --name test_instance --instance c5.2xlarge
Screenshot 2026-03-18 at 14 48 24
Scenario 6: Create a new IA session with custom storage size
cloudos interactive-session create --session-type jupyter --name test_storage --storage 1000
Screenshot 2026-03-18 at 14 50 21
Scenario 7: Create a new IA session with spot instance flag
cloudos interactive-session create --session-type jupyter --name test_spot --spot
Screenshot 2026-03-18 at 14 51 02
Scenario 8: Create a new IA session with shutdown timeout
cloudos interactive-session create --session-type jupyter --name test_time --shutdown-in 10m
Screenshot 2026-03-18 at 15 20 03 Screenshot 2026-03-18 at 15 19 42
Scenario 9: Create a new IA session with cost limit
cloudos interactive-session create --session-type jupyter --name test_cost --cost-limit 0.05
Screenshot 2026-03-18 at 15 22 04
Scenario 10: Create a new IA session with shared flag
cloudos interactive-session create --session-type jupyter --name test_public --shared
Screenshot 2026-03-18 at 15 09 16
Scenario 11: Create a new RStudio IA session with specific R version
cloudos interactive-session create --session-type rstudio --name test_rstudio --r-version 4.4.2
Screenshot 2026-03-18 at 15 11 44
Scenario 12: Create a new Spark IA session with custom master and worker configuration
cloudos interactive-session create --session-type spark --name test_spark --spark-master c5.xlarge --spark-workers 2 --spark-core c5.xlarge
Screenshot 2026-03-18 at 15 12 27
Scenario 13: Create a new IA session with linked file explorer data
cloudos interactive-session create --session-type jupyter --name test_link_fe --link leila-test/AnalysesResults/JG_1shard_chr15-68f210f9e2fdcb612f8e6fe8/results/pipeline_info
Screenshot 2026-03-18 at 15 13 37 Screenshot 2026-03-18 at 15 14 02
Scenario 14: Create a new IA session with linked S3 data
cloudos interactive-session create --session-type jupyter --name test_link_s3 --link s3://lifebit-featured-datasets/pipelines/phewas/example-data/
Screenshot 2026-03-18 at 15 14 37 Screenshot 2026-03-18 at 15 14 54
Scenario 15: Create a new IA session with mounted S3 data
cloudos interactive-session create --session-type jupyter --name test_mount_s3 --mount s3://lifebit-featured-datasets/pipelines/phewas/100_binary_pheno.phe
Screenshot 2026-03-18 at 15 24 56 Screenshot 2026-03-18 at 15 25 23
Scenario 16: Create a new IA session with mounted file explorer data
cloudos interactive-session create --session-type jupyter --name test_mount_fe --mount leila-test/Data/benchmark_test.txt

<img width="1040" height="498" alt="Screenshot 2026-03-18 at 15 26 10" src="https://github.com/user-attachments/assets/48b4cd81-1c82
Screenshot 2026-03-18 at 15 26 24
-4642-a431-ec153c092605" />

Scenario 17: Attempt to create a session with an unsupported session type
cloudos interactive-session create --session-type invalid_type --name test_invalid
Screenshot 2026-03-18 at 15 27 34
Scenario 18: Attempt to create a session with invalid credentials
cloudos interactive-session create --session-type jupyter --name test_auth --apikey invalid_key --cloudos-url https://test.com
Screenshot 2026-03-18 at 15 30 19
Scenario 19: Attempt to create a session with missing required parameters
cloudos interactive-session create --session-type jupyter
Screenshot 2026-03-18 at 15 44 46
AZURE IA CREATION
cloudos interactive-session create --profile prod-azure --name Azure_test --session-type rstudio --r-version 4.5.2 --project-name Test-cli
Screenshot 2026-03-18 at 17 47 03 Screenshot 2026-03-18 at 18 05 01

@l-mansouri l-mansouri marked this pull request as draft March 18, 2026 14:55
@l-mansouri l-mansouri marked this pull request as ready for review March 18, 2026 14:55
@l-mansouri l-mansouri marked this pull request as draft March 18, 2026 14:58
@l-mansouri l-mansouri marked this pull request as ready for review March 18, 2026 14:58
@l-mansouri l-mansouri marked this pull request as draft March 18, 2026 14:59
@l-mansouri l-mansouri marked this pull request as ready for review March 18, 2026 15:00
@l-mansouri l-mansouri marked this pull request as draft March 18, 2026 15:03
@l-mansouri l-mansouri marked this pull request as ready for review March 18, 2026 15:03
@l-mansouri l-mansouri marked this pull request as draft March 18, 2026 15:09
@l-mansouri l-mansouri marked this pull request as ready for review March 18, 2026 15:09
@l-mansouri l-mansouri marked this pull request as draft March 18, 2026 15:15
@l-mansouri l-mansouri marked this pull request as ready for review March 18, 2026 15:15
@l-mansouri l-mansouri marked this pull request as draft March 18, 2026 17:17
@l-mansouri l-mansouri marked this pull request as ready for review March 18, 2026 17:17
@l-mansouri l-mansouri marked this pull request as draft March 18, 2026 17:27
@l-mansouri l-mansouri marked this pull request as ready for review March 18, 2026 17:27
@l-mansouri l-mansouri marked this pull request as draft March 18, 2026 17:37
@l-mansouri l-mansouri marked this pull request as ready for review March 18, 2026 17:37
@l-mansouri l-mansouri marked this pull request as draft March 19, 2026 10:13
@l-mansouri l-mansouri marked this pull request as ready for review March 19, 2026 10:13
Copy link
Collaborator

@danielboloc danielboloc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks @l-mansouri

I have tested it in my local env, and I have some questions:

  1. Using --table-columns with --help it just displays an empty table, but if I use --table-columns id for example, it does show only the help. Could you please check what could happen?
Image
  1. In Scenario 2 of listing you are using cloudos interactive-session list --table-columns status,name,owner,project,created_at,runtime,saved_at,cost,resources,backend,version, but these columns do not appear as options in the help section

  2. Could we change the Type of the sessions to not appear as awsRstudio,awsVSCode,awsJupyterNotebook raw values, and have them as in the Platform UI?

Image
  1. Could we change --filter-owner-only to --filter-only-mine as in the job list subcommand? Or we could do the reverse, change the jobs one as this one, but let's have them unified in the option name

  2. --output-format csv does not show user name, maybe because it uses user.name?

Image
  1. Why the json output format is limited to 10 sessions, but not csv? Why this limit?
Image
  1. Should we do a check for instance type? I have added a non-existent type and it send the session
Image
  1. Should we also add a new column for spot type instances, either when creating the session or when listing it?
Image
  1. The same as for --shutdown-in (how much time has left), --cost-limit (how much cost is left), --shared

thank you

Copy link
Collaborator

@dapineyro dapineyro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @l-mansouri ! Huge work here, that's why there are so many comments. But it looks great overall. Thanks!

PROJECT_NAME: "cloudos-cli-tests"
CLOUDOS_URL: "https://cloudos.lifebit.ai"
run: |
cloudos interactive-session create --cloudos-url $CLOUDOS_URL --apikey $CLOUDOS_TOKEN --workspace-id $CLOUDOS_WORKSPACE_ID --project-name "$PROJECT_NAME" --name ci_test_cli --session-type jupyter --shutdown-in 10m
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
cloudos interactive-session create --cloudos-url $CLOUDOS_URL --apikey $CLOUDOS_TOKEN --workspace-id $CLOUDOS_WORKSPACE_ID --project-name "$PROJECT_NAME" --name ci_test_cli --session-type jupyter --shutdown-in 10m
cloudos interactive-session create --cloudos-url $CLOUDOS_URL --apikey $CLOUDOS_TOKEN --workspace-id $CLOUDOS_WORKSPACE_ID --project-name "$PROJECT_NAME" --name ci_test_cli --session-type jupyter --shutdown-in 1m

Why to keep it open 10m?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because in 1 minute the session is not fully running. And also for the rest of the commands that will require this one to work

PROJECT_NAME: "cloudos-cli-tests"
INSTANCE_TYPE: "Standard_D4as_v4"
run: |
cloudos interactive-session create --cloudos-url $CLOUDOS_URL --apikey $CLOUDOS_TOKEN --workspace-id $CLOUDOS_WORKSPACE_ID --project-name "$PROJECT_NAME" --name ci_test_cli --session-type jupyter --shutdown-in 10m --execution-platform azure --instance $INSTANCE_TYPE
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
cloudos interactive-session create --cloudos-url $CLOUDOS_URL --apikey $CLOUDOS_TOKEN --workspace-id $CLOUDOS_WORKSPACE_ID --project-name "$PROJECT_NAME" --name ci_test_cli --session-type jupyter --shutdown-in 10m --execution-platform azure --instance $INSTANCE_TYPE
cloudos interactive-session create --cloudos-url $CLOUDOS_URL --apikey $CLOUDOS_TOKEN --workspace-id $CLOUDOS_WORKSPACE_ID --project-name "$PROJECT_NAME" --name ci_test_cli --session-type jupyter --shutdown-in 1m --execution-platform azure --instance $INSTANCE_TYPE

CLOUDOS_URL: "https://dev.sdlc.lifebit.ai"
PROJECT_NAME: "cloudos-cli-tests"
run: |
cloudos interactive-session create --cloudos-url $CLOUDOS_URL --apikey $CLOUDOS_TOKEN --workspace-id $CLOUDOS_WORKSPACE_ID --project-name "$PROJECT_NAME" --name ci_test_cli --session-type jupyter --shutdown-in 10m
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

        cloudos interactive-session create --cloudos-url $CLOUDOS_URL --apikey $CLOUDOS_TOKEN --workspace-id $CLOUDOS_WORKSPACE_ID --project-name "$PROJECT_NAME" --name ci_test_cli --session-type jupyter --shutdown-in 1m

Co-authored-by: dapineyro <45285897+dapineyro@users.noreply.github.com>
@l-mansouri
Copy link
Collaborator Author

l-mansouri commented Mar 20, 2026

Thanks Dani and David, I should have addressed all your comments.

@danielboloc regarding your questions:

  1. It was a misinterpretation of the flags. I have fixed that by implementing a parsing and check of the column names against the list of available columns.
Screenshot 2026-03-20 at 16 39 35 2. the list of available columns is now added to the help text Screenshot 2026-03-20 at 16 38 49 3. you're right, it makes the table more human readable. I have implemented a mapping function Screenshot 2026-03-20 at 16 41 37
  1. the flag now is --filter-only-mine as the other commands.
Screenshot 2026-03-20 at 16 41 59
  1. I have fixed that there was a wrong mapping on my side. Thank you for spotting it
  2. Both csv and json were already returning 10 results (the number is changeable with the --limit flag). Now both of the execution print a message with the number of lines. The only reason why the two files output only 10 values is to not create huge files that can be hard to navigate, but what is outputted is fully customisable using the --limit --page flags
Screenshot 2026-03-20 at 16 43 23
  1. I have added a function that prevents typos, but your test would still go through, even if the session is not created as the endpoint does not return an error and the regex for the check must be flexible enough to cover a variety of potential instances. (the regex is looking for this pattern aws_pattern = r'^[a-z]{1,4}\d+[a-z]*\.(\d+)?(nano|micro|small|medium|large|xlarge|metal)$' and azure_pattern = r'^(Standard|Basic)_[A-Z]\d+[a-z]*(_v\d+)?$')

  2. e 9. I have added specific columns to the listing to report on all those things.

Screenshot 2026-03-20 at 16 35 13

@dapineyro Thanks for spotting some of the left-overs of not-working implemenations! I have reviewed and tidied the README.

@l-mansouri l-mansouri marked this pull request as draft March 20, 2026 16:02
@l-mansouri l-mansouri marked this pull request as ready for review March 20, 2026 16:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants