Contents Menu Expand Light mode Dark mode Auto light/dark, in light mode Auto light/dark, in dark mode Skip to content
CloudOS CLI Documentation
CloudOS CLI Documentation

Contents:

  • Getting Started
  • cloudos-cli
  • CLI Reference
  • API Reference
    • cloudos_cli
      • cloudos_cli.bash
        • cloudos_cli.bash.cli
      • cloudos_cli.clos
      • cloudos_cli.configure
        • cloudos_cli.configure.cli
        • cloudos_cli.configure.configure
      • cloudos_cli.constants
      • cloudos_cli.cost
        • cloudos_cli.cost.cost
      • cloudos_cli.cromwell
        • cloudos_cli.cromwell.cli
      • cloudos_cli.datasets
        • cloudos_cli.datasets.cli
        • cloudos_cli.datasets.datasets
      • cloudos_cli.import_wf
        • cloudos_cli.import_wf.import_wf
      • cloudos_cli.interactive_session
        • cloudos_cli.interactive_session.cli
        • cloudos_cli.interactive_session.interactive_session
      • cloudos_cli.jobs
        • cloudos_cli.jobs.cli
        • cloudos_cli.jobs.job
      • cloudos_cli.link
        • cloudos_cli.link.cli
        • cloudos_cli.link.link
      • cloudos_cli.logging
        • cloudos_cli.logging.logger
      • cloudos_cli.procurement
        • cloudos_cli.procurement.cli
        • cloudos_cli.procurement.images
      • cloudos_cli.projects
        • cloudos_cli.projects.cli
      • cloudos_cli.queue
        • cloudos_cli.queue.cli
        • cloudos_cli.queue.queue
      • cloudos_cli.related_analyses
        • cloudos_cli.related_analyses.related_analyses
      • cloudos_cli.utils
        • cloudos_cli.utils.array_job
        • cloudos_cli.utils.cli_helpers
        • cloudos_cli.utils.cloud
        • cloudos_cli.utils.details
        • cloudos_cli.utils.errors
        • cloudos_cli.utils.last_wf
        • cloudos_cli.utils.nextflow_version
        • cloudos_cli.utils.requests
        • cloudos_cli.utils.resources
      • cloudos_cli.workflows
        • cloudos_cli.workflows.cli
    • cloudos_cli._version
    • cloudos_cli.clos
    • cloudos_cli.configure
      • cloudos_cli.configure.cli
      • cloudos_cli.configure.configure
    • cloudos_cli.configure.configure
    • cloudos_cli.datasets
      • cloudos_cli.datasets.cli
      • cloudos_cli.datasets.datasets
    • cloudos_cli.datasets.datasets
    • cloudos_cli.import_wf
      • cloudos_cli.import_wf.import_wf
    • cloudos_cli.import_wf.import_wf
    • cloudos_cli.jobs
      • cloudos_cli.jobs.cli
      • cloudos_cli.jobs.job
    • cloudos_cli.jobs.job
    • cloudos_cli.link
      • cloudos_cli.link.cli
      • cloudos_cli.link.link
    • cloudos_cli.link.link
    • cloudos_cli.procurement
      • cloudos_cli.procurement.cli
      • cloudos_cli.procurement.images
    • cloudos_cli.procurement.images
    • cloudos_cli.queue
      • cloudos_cli.queue.cli
      • cloudos_cli.queue.queue
    • cloudos_cli.queue.queue
    • cloudos_cli.utils
      • cloudos_cli.utils.array_job
      • cloudos_cli.utils.cli_helpers
      • cloudos_cli.utils.cloud
      • cloudos_cli.utils.details
      • cloudos_cli.utils.errors
      • cloudos_cli.utils.last_wf
      • cloudos_cli.utils.nextflow_version
      • cloudos_cli.utils.requests
      • cloudos_cli.utils.resources
    • cloudos_cli.utils.array_job
    • cloudos_cli.utils.cloud
    • cloudos_cli.utils.details
    • cloudos_cli.utils.errors
    • cloudos_cli.utils.last_wf
    • cloudos_cli.utils.requests
    • cloudos_cli.utils.resources
Back to top
View this page

cloudos_cli.link.link¶

This is the main class for linking files to interactive sessions.

Classes

Link(cloudos_url, apikey, cromwell_token, ...)

Class for linking folders/files to interactive sessions.

class cloudos_cli.link.link.Link(cloudos_url, apikey, cromwell_token, workspace_id, project_name, verify=True)[source]¶

Bases: Cloudos

Class for linking folders/files to interactive sessions.

Parameters:
  • cloudos_url (string) – The Lifebit Platform service url.

  • apikey (string) – Your Lifebit Platform API key.

  • workspace_id (string) – The specific Cloudos workspace id.

  • verify ([bool|string]) – Whether to use SSL verification or not. Alternatively, if a string is passed, it will be interpreted as the path to the SSL certificate file.

  • cromwell_token (str)

  • project_name (str)

abort_interactive_session(session_id, team_id, upload_on_close=True, force_abort=False, verify=True)¶

Abort and stop a running interactive session.

Parameters:
  • session_id (string) – The session ID (MongoDB ObjectId) to abort.

  • team_id (string) – The Lifebit Platform team id (workspace id) where the session is running.

  • upload_on_close (bool, optional) – If True, save session data to S3 before terminating. Default=True.

  • force_abort (bool, optional) – If True, force immediate termination (skip graceful shutdown). Default=False.

  • verify ([bool|string], default=True) – Whether to use SSL verification or not. Alternatively, if a string is passed, it will be interpreted as the path to the SSL certificate file.

Returns:

HTTP status code (204 for successful abort, no content returned).

Return type:

int

abort_job(job, workspace_id, verify=True, force=False)¶

Abort a job.

Parameters:
  • job (string) – The Lifebit Platform job id of the job to abort.

  • verify ([bool|string]) – Whether to use SSL verification or not. Alternatively, if a string is passed, it will be interpreted as the path to the SSL certificate file.

  • force (bool) – Whether to force abort the job. Default is False.

Returns:

r – The server response

Return type:

requests.models.Response

apikey: str¶
archive_jobs(job_ids, workspace_id, verify=True)¶

Archive one or more jobs.

Parameters:
  • job_ids (list) – The Lifebit Platform job ids of the jobs to archive.

  • workspace_id (string) – The Lifebit Platform workspace id.

  • verify ([bool|string]) – Whether to use SSL verification or not. Alternatively, if a string is passed, it will be interpreted as the path to the SSL certificate file.

Returns:

r – The server response

Return type:

requests.models.Response

check_jobs_archive_status(job_ids, workspace_id, target_archived_state, verify=True, verbose=False)¶

Check the archive status of multiple jobs and separate them into actionable, already-processed, and invalid lists.

Parameters:
  • job_ids (list) – List of job IDs to check.

  • workspace_id (str) – The Lifebit Platform workspace id.

  • target_archived_state (bool) – True if checking for archiving operation, False if checking for unarchiving operation.

  • verify ([bool | str], optional) – Whether to use SSL verification or not. Default is True.

  • verbose (bool, optional) – Whether to print detailed information. Default is False.

Returns:

Dictionary with ‘valid_jobs’ (list of jobs that need action), ‘already_processed’ (list of jobs already in target state), and ‘invalid_jobs’ (dict mapping job IDs to error messages).

Return type:

dict

cloudos_url: str¶
create_interactive_session(team_id, payload, verify=True)¶

Create and start a new interactive session.

Parameters:
  • team_id (string) – The Lifebit Platform team id (workspace id) to create session in.

  • payload (dict) – Complete session creation payload with configuration, data items, etc.

  • verify ([bool|string], default=True) – Whether to use SSL verification or not. Alternatively, if a string is passed, it will be interpreted as the path to the SSL certificate file.

Returns:

Session object from API response with _id, status, and all configuration.

Return type:

dict

create_project(workspace_id, project_name, verify=True)¶

Create a new project in Lifebit Platform.

Parameters:
  • workspace_id (str) – The Lifebit Platform workspace ID where the project will be created.

  • project_name (str) – The name for the new project.

  • verify ([bool | str], optional) – Whether to use SSL verification or not. Alternatively, if a string is passed, it will be interpreted as the path to the SSL certificate file. Default is True.

Returns:

The ID of the newly created project.

Return type:

str

Raises:

BadRequestException – If the request to create the project fails with a status code indicating an error.

cromwell_switch(workspace_id, action, verify=True)¶

Restart Cromwell server.

Parameters:
  • workspace_id (string) – The Lifebit Platform workspace id in which restart/stop Cromwell status.

  • action (string [restart|stop]) – The action to perform.

  • verify ([bool|string]) – Whether to use SSL verification or not. Alternatively, if a string is passed, it will be interpreted as the path to the SSL certificate file.

Returns:

r – The server response

Return type:

requests.models.Response

cromwell_token: str¶
detect_workflow(workflow_name, workspace_id, verify=True, last=False)¶

Detects workflow type: nextflow or wdl.

Parameters:
  • workflow_name (string) – Name of the workflow.

  • workspace_id (string) – The Lifebit Platform workspace id from to collect the workflows.

  • verify ([bool|string]) – Whether to use SSL verification or not. Alternatively, if a string is passed, it will be interpreted as the path to the SSL certificate file.

Returns:

wt – The workflow type detected

Return type:

string [‘nextflow’|’wdl’]

get_cromwell_status(workspace_id, verify=True)¶

Get Cromwell server status from Lifebit Platform.

Parameters:
  • workspace_id (string) – The Lifebit Platform workspace id from to check the Cromwell status.

  • verify ([bool|string]) – Whether to use SSL verification or not. Alternatively, if a string is passed, it will be interpreted as the path to the SSL certificate file.

Returns:

r – The server response

Return type:

requests.models.Response

get_folder_deletion_status(folder_id, workspace_id, verify=True)¶

Get deletion status of a specific folder by ID.

Simple API wrapper to query the folders API for a specific folder with its deletion status (ready/deleting/etc).

Parameters:
  • folder_id (str) – The Lifebit Platform folder ID.

  • workspace_id (str) – The Lifebit Platform workspace ID.

  • verify ([bool | str], optional) – Whether to use SSL verification or not. Alternatively, if a string is passed, it will be interpreted as the path to the SSL certificate file. Default is True.

Returns:

The API response containing folder information with status.

Return type:

Response

Raises:

BadRequestException – If the request fails with a status code indicating an error.

get_folder_items_deletion_status(folder_id, workspace_id, verify=True)¶

Get deletion status of items within a folder.

Simple API wrapper to query the datasets API for items in a folder with their deletion status (ready/deleting).

Parameters:
  • folder_id (str) – The Lifebit Platform folder ID.

  • workspace_id (str) – The Lifebit Platform workspace ID.

  • verify ([bool | str], optional) – Whether to use SSL verification or not. Alternatively, if a string is passed, it will be interpreted as the path to the SSL certificate file. Default is True.

Returns:

The API response containing folders and files with their status.

Return type:

Response

Raises:

BadRequestException – If the request fails with a status code indicating an error.

get_fuse_filesystems_status(session_id)[source]¶

Get the status of fuse filesystems for an interactive session.

Parameters:

session_id (str) – The interactive session ID.

Returns:

List of fuse filesystem objects with their status information.

Return type:

List[Dict]

Raises:

ValueError – If the API request fails or returns an error.

get_interactive_session_list(team_id, page=None, limit=None, status=None, owner_only=False, include_archived=False, verify=True)¶

Get interactive sessions from a Lifebit Platform team.

Parameters:
  • team_id (string) – The Lifebit Platform team id (workspace id) to retrieve sessions from.

  • page (int, optional) – Page number for pagination. Default=1.

  • limit (int, optional) – Number of results per page. Default=10, max=100.

  • status (list of string, optional) – Filter by session status. Valid values: running, stopped, provisioning, scheduled.

  • owner_only (bool, optional) – If True, retrieve only the current user’s sessions.

  • include_archived (bool, optional) – If True, include archived sessions in results.

  • verify ([bool|string], default=True) – Whether to use SSL verification or not. Alternatively, if a string is passed, it will be interpreted as the path to the SSL certificate file.

Returns:

A dict with ‘sessions’ list and ‘pagination_metadata’.

Return type:

dict

get_job_list(workspace_id, last_n_jobs=None, page=None, page_size=None, archived=False, verify=True, filter_status=None, filter_job_name=None, filter_project=None, filter_workflow=None, filter_job_id=None, filter_only_mine=False, filter_owner=None, filter_queue=None, last=False)¶

Get jobs from a Lifebit Platform workspace with optional filtering.

Fetches jobs page by page, applies all filters after fetching. Stops when enough jobs are collected or no more jobs are available.

Parameters:
  • workspace_id (string) – The Lifebit Platform workspace id from to collect the jobs.

  • last_n_jobs ([int | 'all'], default=None) – How many of the last jobs from the user to retrieve. You can specify a very large int or ‘all’ to get all user’s jobs. When specified, page and page_size parameters are ignored.

  • page (int, default=None) – Response page to get when not using last_n_jobs.

  • page_size (int, default=None) – Number of jobs to retrieve per page when not using last_n_jobs. Maximum allowed value is 100.

  • archived (bool, default=False) – When True, only the archived jobs are retrieved.

  • verify ([bool|string], default=True) – Whether to use SSL verification or not. Alternatively, if a string is passed, it will be interpreted as the path to the SSL certificate file.

  • filter_status (string, optional) – Filter jobs by status (e.g., ‘completed’, ‘running’, ‘failed’).

  • filter_job_name (string, optional) – Filter jobs by name.

  • filter_project (string, optional) – Filter jobs by project name (will be resolved to project ID).

  • filter_workflow (string, optional) – Filter jobs by workflow name (will be resolved to workflow ID).

  • filter_job_id (string, optional) – Filter jobs by specific job ID.

  • filter_only_mine (bool, optional) – Filter to show only jobs belonging to the current user.

  • filter_owner (string, optional) – Filter jobs by owner username (will be resolved to user ID).

  • filter_queue (string, optional) – Filter jobs by queue name (will be resolved to queue ID). Only applies to jobs running in batch environment. Non-batch jobs are preserved in results as they don’t use queues.

  • last (bool, optional) – When workflows are duplicated, use the latest imported workflow (by date).

Returns:

r – A list of dicts, each corresponding to a jobs from the user and the workspace.

Return type:

list

get_job_logs(j_id, workspace_id, verify=True)¶

Get the location of the logs for the specified job

get_job_results(j_id, workspace_id, verify=True)¶

Get the location of the results for the specified job

get_job_status(j_id, workspace_id=None, verify=True)¶

Get job status from Lifebit Platform.

Parameters:
  • j_id (string) – The Lifebit Platform job id of the job just launched.

  • workspace_id (string) – The Lifebit Platform workspace id from to check the job status.

  • verify ([bool|string]) – Whether to use SSL verification or not. Alternatively, if a string is passed, it will be interpreted as the path to the SSL certificate file.

Returns:

r – The server response

Return type:

requests.models.Response

get_job_workdir(j_id, workspace_id, verify=True)¶

Get the working directory for the specified job

get_project_id_from_name(workspace_id, project_name, verify=True)¶

Retrieve the project ID from its name.

Parameters:
  • workspace_id (str) – The Lifebit Platform workspace ID to search for the project.

  • project_name (str) – The name of the project to search for.

  • verify ([bool | str], optional) – Whether to use SSL verification or not. Alternatively, if a string is passed, it will be interpreted as the path to the SSL certificate file. Default is True.

Returns:

The server response containing project details.

Return type:

dict

Raises:

BadRequestException – If the request to retrieve the project fails with a status code indicating an error.

get_project_list(workspace_id, verify=True, get_all=True, page=1, page_size=10, max_page_size=100)¶

Get all the project from a Lifebit Platform workspace.

Parameters:
  • workspace_id (string) – The Lifebit Platform workspace id from to collect the projects.

  • verify ([bool|string]) – Whether to use SSL verification or not. Alternatively, if a string is passed, it will be interpreted as the path to the SSL certificate file.

  • get_all (bool) – Whether to get all available curated workflows or just the indicated page.

  • page (int) – The page number to retrieve, from the paginated response.

  • page_size (int) – The number of workflows by page. From 1 to 1000.

  • max_page_size (int) – Max page size defined by the API server. It is currently 1000.

Returns:

r – The server response

Return type:

requests.models.Response

get_results_deletion_status(job_id, workspace_id, verify=True)¶

Get the deletion status of a specific job’s results folder.

This method orchestrates finding the job’s results folder and retrieving the deletion status of items within it.

Parameters:
  • job_id (str) – The Lifebit Platform job ID.

  • workspace_id (str) – The Lifebit Platform workspace ID.

  • verify ([bool | str], optional) – Whether to use SSL verification or not. Alternatively, if a string is passed, it will be interpreted as the path to the SSL certificate file. Default is True.

Returns:

A dictionary containing the deletion status information with the following structure: {

”job_id”: str, # The job ID “job_name”: str, # The job name “results_folder_id”: str, # The ID of the job’s results folder “results_folder_name”: str, # The name of the job’s results folder “items”: dict # Dictionary with ‘folders’ and ‘files’ arrays containing items and their status

}

Return type:

dict

Raises:
  • BadRequestException – If the request fails with a status code indicating an error.

  • ValueError – If the job’s results folder is not found.

get_storage_contents(cloud_name, cloud_meta, container, path, workspace_id, verify)¶

Retrieves the contents of a storage container from the specified cloud service.

This method fetches the contents of a specified path within a storage container on a cloud service (e.g., AWS S3 or Azure Blob). The request is authenticated using an API key and requires valid parameters such as the workspace ID and path.

Parameters:
  • cloud_name (str) – The name of the cloud service (e.g., ‘aws’ or ‘azure’).

  • container (str) – The name of the storage container or bucket.

  • path (str) – The file path or directory within the storage container.

  • workspace_id (str) – The identifier of the workspace or team.

  • verify (bool) – Whether to verify SSL certificates for the request.

Returns:

A list of contents retrieved from the specified cloud storage.

Return type:

list

Raises:
  • BadRequestException – If the request to retrieve the contents fails with a

  • status code indicating an error. –

get_user_info(verify=True)¶

Gets user information from users/me endpoint

Parameters:

verify ([bool|string]) – Whether to use SSL verification or not. Alternatively, if a string is passed, it will be interpreted as the path to the SSL certificate file.

Returns:

r – The server response content

Return type:

requests.models.Response.content

get_workdir_deletion_status(job_id, workspace_id, verify=True)¶

Get the deletion status of a specific job’s working directory.

This method retrieves the deletion status of the job’s working directory using the folders API endpoint.

Parameters:
  • job_id (str) – The Lifebit Platform job ID.

  • workspace_id (str) – The Lifebit Platform workspace ID.

  • verify ([bool | str], optional) – Whether to use SSL verification or not. Alternatively, if a string is passed, it will be interpreted as the path to the SSL certificate file. Default is True.

Returns:

A dictionary containing the deletion status information with the following structure: {

”job_id”: str, # The job ID “job_name”: str, # The job name “workdir_folder_id”: str, # The ID of the job’s working directory folder “workdir_folder_name”: str, # The name of the job’s working directory folder “status”: str, # The deletion status “items”: dict # Full folder object with metadata

}

Return type:

dict

Raises:
  • BadRequestException – If the request fails with a status code indicating an error.

  • ValueError – If the job’s working directory is not found or not accessible.

get_workflow_content(workspace_id, workflow_name, verify=True, last=False, max_page_size=100)¶

Retrieve the workflow content from API.

Parameters:
  • workspace_id (str) – The Lifebit Platform workspace ID to search for the workflow.

  • workflow_name (str) – The name of the workflow to search for.

  • verify ([bool | str], optional) – Whether to use SSL verification or not. Alternatively, if a string is passed, it will be interpreted as the path to the SSL certificate file. Default is True.

Returns:

The server response containing workflow details.

Return type:

dict

Raises:

BadRequestException – If the request to retrieve the project fails with a status code indicating an error.

get_workflow_list(workspace_id, verify=True, get_all=True, page=1, page_size=10, max_page_size=100, archived_status=False)¶

Get all the workflows from a Lifebit Platform workspace.

Parameters:
  • workspace_id (string) – The Lifebit Platform workspace id from to collect the workflows.

  • verify ([bool|string]) – Whether to use SSL verification or not. Alternatively, if a string is passed, it will be interpreted as the path to the SSL certificate file.

  • get_all (bool) – Whether to get all available curated workflows or just the indicated page.

  • page (int) – The page number to retrieve, from the paginated response.

  • page_size (int) – The number of workflows by page. From 1 to 1000.

  • max_page_size (int) – Max page size defined by the API server. It is currently 1000.

  • archived_status (bool) – Whether to retrieve archived workflows or not.

Returns:

r – A list of dicts, each corresponding to a workflow.

Return type:

list

get_workflow_max_pagination(workspace_id, workflow_name, verify=True)¶

Retrieve the workflows max pages from API.

Parameters:
  • workspace_id (str) – The Lifebit Platform workspace ID to search for the workflow.

  • workflow_name (str) – The name of the workflow to search for.

  • verify ([bool | str], optional) – Whether to use SSL verification or not. Alternatively, if a string is passed, it will be interpreted as the path to the SSL certificate file. Default is True.

Returns:

The server response with max pagination for workflows.

Return type:

int

Raises:

BadRequestException – If the request to retrieve the project fails with a status code indicating an error.

is_module(workflow_name, workspace_id, verify=True, last=False)¶

Detects whether the workflow is a system module or not.

System modules use fixed queues, so this check is important to properly manage queue selection.

Parameters:
  • workflow_name (string) – Name of the workflow.

  • workspace_id (string) – The Lifebit Platform workspace id from to collect the workflows.

  • verify ([bool|string]) – Whether to use SSL verification or not. Alternatively, if a string is passed, it will be interpreted as the path to the SSL certificate file.

Returns:

True, if the workflow is a system module, false otherwise.

Return type:

bool

link_folder(folder, session_id)[source]¶

Link a folder (S3 or File Explorer) to an interactive session.

Attempts to use API v2 first, with automatic fallback to v1 if v2 is not available.

Parameters:
  • folder (str) – The folder to link.

  • session_id (str) – The interactive session ID.

Raises:

ValueError – If the URL already exists with ‘mounted’ status If the API key is invalid or permissions are insufficient If the URL is invalid or the session is not active.

Return type:

dict

link_folders_batch(folders, session_id)[source]¶

Link multiple folders (S3 or File Explorer) to an interactive session in one request.

Attempts to use API v2 (which supports multiple folders per request) first, with automatic fallback to v1 (individual requests) if v2 is not available.

Parameters:
  • folders (list) – List of folder paths to link.

  • session_id (str) – The interactive session ID.

Raises:

ValueError – If any validation fails or API errors occur.

Return type:

None

link_job_logs(job_id, workspace_id, session_id, verify_ssl, verbose=False)[source]¶

Link job logs to an interactive session.

Parameters:
  • job_id (str) – The job ID to link logs from

  • workspace_id (str) – The workspace ID

  • session_id (str) – The interactive session ID

  • verify_ssl (Union[bool, str]) – SSL verification setting

  • verbose (bool) – Whether to print verbose output

Returns:

Prints status messages to console

Return type:

None

link_job_results(job_id, workspace_id, session_id, verify_ssl, verbose=False)[source]¶

Link job results to an interactive session.

Parameters:
  • job_id (str) – The job ID to link results from

  • workspace_id (str) – The workspace ID

  • session_id (str) – The interactive session ID

  • verify_ssl (Union[bool, str]) – SSL verification setting

  • verbose (bool) – Whether to print verbose output

Returns:

Prints status messages to console

Return type:

None

link_job_workdir(job_id, workspace_id, session_id, verify_ssl, verbose=False)[source]¶

Link job working directory to an interactive session.

Parameters:
  • job_id (str) – The job ID to link workdir from

  • workspace_id (str) – The workspace ID

  • session_id (str) – The interactive session ID

  • verify_ssl (Union[bool, str]) – SSL verification setting

  • verbose (bool) – Whether to print verbose output

Returns:

Prints status messages to console

Return type:

None

mount_fuse_filesystem_v2(session_id, team_id, payload, verify=True)¶

Mount a FUSE filesystem into an interactive session (API v2).

Parameters:
  • session_id (string) – The session ID (MongoDB ObjectId) to mount filesystem to.

  • team_id (string) – The CloudOS team id (workspace id).

  • payload (dict) – FuseFileSystemMount payload with dataItems array configuration. For S3: {“dataItems”: [{“type”: “S3Folder”, “data”: {“name”: str, “s3BucketName”: str, “s3Prefix”: str}}, …]} For File Explorer: {“dataItems”: [{“kind”: “Folder”, “item”: str, “name”: str}, …]}

  • verify ([bool|string], default=True) – Whether to use SSL verification or not. Alternatively, if a string is passed, it will be interpreted as the path to the SSL certificate file.

Returns:

HTTP status code (204 for successful mount, no content returned).

Return type:

int

parse_file_explorer_path(path)[source]¶

Parse a File Explorer path and return folder metadata.

Note: This method does basic parsing only. Validation of folder existence should be done separately in the calling code if needed.

Parameters:

file_path (str) – The file path to parse.

Returns:

A dictionary containing the parsed file information structured as: {“dataItem”: {“type”: “File”, “data”: {“name”: str, “fullPath”: str}}}

Return type:

dict

parse_s3_path(s3_url)[source]¶

Parses an S3 URL and extracts the bucket name, prefix, and base name.

Parameters:

s3_url (str) – The S3 URL to parse. Must start with “s3://”.

Returns:

dict –

“dataItem”: {

“type”: “S3Folder”, “data”: {

”name”: str, # The base name (last segment of the prefix). “s3BucketName”: str, # The name of the S3 bucket. “s3Prefix”: str # The full prefix path in the bucket.

Return type:

A dictionary containing the parsed S3 information structured as:

Raises:

ValueError – If the S3 URL does not start with “s3://”. If the S3 URL does not include a key after the bucket.

static process_job_list(r, all_fields=False)¶

Process a job list from a self.get_job_list call.

Parameters:
  • r (list) – A list of dicts, each corresponding to a job from the user and the workspace.

  • all_fields (bool. Default=False) – Whether to return a reduced version of the DataFrame containing only the selected columns or the full DataFrame.

Returns:

df – A DataFrame with the requested columns from the jobs.

Return type:

pandas.DataFrame

static process_project_list(r, all_fields=False)¶

Process a server response from a self.get_project_list call.

Parameters:
  • r (requests.models.Response) – A list of dicts, each corresponding to a project.

  • all_fields (bool. Default=False) – Whether to return a reduced version of the DataFrame containing only the selected columns or the full DataFrame.

Returns:

df – A DataFrame with the requested columns from the projects.

Return type:

pandas.DataFrame

static process_workflow_list(r, all_fields=False)¶

Process a server response from a self.get_workflow_list call.

Parameters:
  • r (list) – A list of dicts, each corresponding to a workflow.

  • all_fields (bool. Default=False) – Whether to return a reduced version of the DataFrame containing only the selected columns or the full DataFrame.

Returns:

df – A DataFrame with the requested columns from the workflows.

Return type:

pandas.DataFrame

project_name: str¶
reorder_job_list(my_jobs_df, filename='my_jobs.csv')¶

Save a job list DataFrame to a CSV file with renamed and ordered columns.

Parameters:
  • my_jobs_df (pandas.DataFrame) – A DataFrame containing job information from process_job_list.

  • filename (str) – The name of the file to save the DataFrame to. Default is ‘my_jobs.csv’.

Returns:

Saves the DataFrame to a CSV file with renamed and ordered columns.

Return type:

None

resolve_user_id(filter_owner, workspace_id, verify=True)¶

Resolve a username or display name to a user ID.

Parameters:
  • filter_owner (str) – The username or display name to search for.

  • workspace_id (str) – The Lifebit Platform workspace ID.

  • verify ([bool|string]) – Whether to use SSL verification or not. Alternatively, if a string is passed, it will be interpreted as the path to the SSL certificate file.

Returns:

The user ID corresponding to the filter_owner.

Return type:

str

Raises:

ValueError – If the user cannot be found or if there’s an error during the search.

resume_interactive_session(session_id, team_id, payload, verify=True)¶

Resume a stopped interactive session with optional configuration updates.

Parameters:
  • session_id (string) – The session ID (MongoDB ObjectId) to resume.

  • team_id (string) – The Lifebit Platform team id (workspace id) where the session is running.

  • payload (dict) – Resume payload with optional dataItems and newInteractiveSessionConfiguration.

  • verify ([bool|string], default=True) – Whether to use SSL verification or not. Alternatively, if a string is passed, it will be interpreted as the path to the SSL certificate file.

Returns:

Updated session object from API response.

Return type:

dict

save_job_list_to_csv(my_jobs_df, filename='my_jobs.csv')¶
unarchive_jobs(job_ids, workspace_id, verify=True)¶

Unarchive one or more jobs.

Parameters:
  • job_ids (list) – The Lifebit Platform job ids of the jobs to unarchive.

  • workspace_id (string) – The Lifebit Platform workspace id.

  • verify ([bool|string]) – Whether to use SSL verification or not. Alternatively, if a string is passed, it will be interpreted as the path to the SSL certificate file.

Returns:

r – The server response

Return type:

requests.models.Response

verify: bool | str = True¶
wait_for_mount_completion(session_id, mount_name, timeout=360, check_interval=2)[source]¶

Wait for a specific mount to complete and return its final status.

Parameters:
  • session_id (str) – The interactive session ID.

  • mount_name (str) – The name of the mount to check.

  • timeout (int, optional) – Maximum time to wait in seconds (default: 60).

  • check_interval (int, optional) – Time between status checks in seconds (default: 2).

Returns:

The final status object of the mount.

Return type:

Dict

Raises:

ValueError – If the mount is not found or timeout is reached.

wait_job_completion(job_id, workspace_id, wait_time=3600, request_interval=30, verbose=False, verify=True)¶

Checks job status from Lifebit Platform and wait for its complation.

Parameters:
  • job_id (string) – The Lifebit Platform job id of the job just launched.

  • workspace_id (string) – The Lifebit Platform workspace id from to check the job status.

  • wait_time (int) – Max time to wait (in seconds) to job completion.

  • request_interval (int) – Time interval (in seconds) to request job status.

  • verbose (bool) – Whether to output status on every request or not.

  • verify ([bool|string]) – Whether to use SSL verification or not. Alternatively, if a string is passed, it will be interpreted as the path to the SSL certificate file.

Returns:

A dict with three elements collected from the job status: ‘name’, ‘id’, ‘status’.

Return type:

dict

workflow_content_query(workspace_id, workflow_name, verify=True, query='workflowType', last=False)¶
workflow_import(workspace_id, workflow_url, workflow_name, repository_project_id, workflow_docs_link='', repository_id=None, verify=True)¶

Imports workflows to Lifebit Platform.

Parameters:
  • workspace_id (string) – The Lifebit Platform workspace id from to collect the projects.

  • workflow_url (string) – The URL of the workflow. Only Github or Bitbucket are allowed.

  • workflow_name (string) – A name for the imported pipeline in Lifebit Platform.

  • repository_project_id (int) – The repository project ID.

  • workflow_docs_link (string) – Link to the documentation URL.

  • repository_id (int) – The repository ID. Only required for GitHub repositories.

  • verify ([bool|string]) – Whether to use SSL verification or not. Alternatively, if a string is passed, it will be interpreted as the path to the SSL certificate file.

Returns:

workflow_id – The newly imported worflow ID.

Return type:

string

workspace_id: str¶
Next
cloudos_cli.logging
Previous
cloudos_cli.link.cli
Copyright © 2025, Lifebit AI
Made with Sphinx and @pradyunsg's Furo
On this page
  • cloudos_cli.link.link
    • Link
      • Link.abort_interactive_session()
      • Link.abort_job()
      • Link.apikey
      • Link.archive_jobs()
      • Link.check_jobs_archive_status()
      • Link.cloudos_url
      • Link.create_interactive_session()
      • Link.create_project()
      • Link.cromwell_switch()
      • Link.cromwell_token
      • Link.detect_workflow()
      • Link.get_cromwell_status()
      • Link.get_folder_deletion_status()
      • Link.get_folder_items_deletion_status()
      • Link.get_fuse_filesystems_status()
      • Link.get_interactive_session_list()
      • Link.get_job_list()
      • Link.get_job_logs()
      • Link.get_job_results()
      • Link.get_job_status()
      • Link.get_job_workdir()
      • Link.get_project_id_from_name()
      • Link.get_project_list()
      • Link.get_results_deletion_status()
      • Link.get_storage_contents()
      • Link.get_user_info()
      • Link.get_workdir_deletion_status()
      • Link.get_workflow_content()
      • Link.get_workflow_list()
      • Link.get_workflow_max_pagination()
      • Link.is_module()
      • Link.link_folder()
      • Link.link_folders_batch()
      • Link.link_job_logs()
      • Link.link_job_results()
      • Link.link_job_workdir()
      • Link.mount_fuse_filesystem_v2()
      • Link.parse_file_explorer_path()
      • Link.parse_s3_path()
      • Link.process_job_list()
      • Link.process_project_list()
      • Link.process_workflow_list()
      • Link.project_name
      • Link.reorder_job_list()
      • Link.resolve_user_id()
      • Link.resume_interactive_session()
      • Link.save_job_list_to_csv()
      • Link.unarchive_jobs()
      • Link.verify
      • Link.wait_for_mount_completion()
      • Link.wait_job_completion()
      • Link.workflow_content_query()
      • Link.workflow_import()
      • Link.workspace_id