steps.api.cloud_objects.cloud_platform

Classes

Platform

Platform class representing a worker in the cloud system.

Module Contents

class steps.api.cloud_objects.cloud_platform.Platform(name: str = '', type: str = 'simulator', platform_id: str = None, worker_id: str = str(uuid4()), specs: dict[str] = {'available_commands': ['probs']}, **kwargs)[source]

Bases: steps.api.cloud_objects.cloud_base.ACloudObject

Platform class representing a worker in the cloud system.

This class handles worker registration, job management, and platform permissions.

Parameters:
  • name – Name of the platform

  • type – Type of platform (default: “simulator”)

  • platform_id – Platform ID (None for new platforms)

  • worker_id – Worker ID (defaults to a new UUID)

  • specs – Platform specifications

  • kwargs – Additional attributes to set on the platform

Raises:

AssertionError – If Platform.ADMIN is None or not an admin

ADMIN = None[source]
REGISTER_ENDPOINT = '/admin/platforms/register'[source]
JOB_ENDPOINT = '/admin/job'[source]
ASSIGN_ENDPOINT = '/api/platform-permissions'[source]
classmethod get_object_name() str[source]
classmethod get_endpoint() str[source]
classmethod get_api(context: steps.api.utils.CloudContext) steps.api.utils.Api[source]
classmethod get_token_method() str[source]
PLATFORM_NAME_KEY = 'platform_name'[source]
DEFAULT_NAME = 'sim:qa'[source]
name = ''[source]
type = 'simulator'[source]
worker_id: str = ''[source]
platform_id: str[source]
specs[source]
register(context: steps.api.utils.CloudContext, register_dict: dict[str] = None) None[source]

Register this platform in the cloud.

Parameters:
  • context – Cloud context for API configuration

  • register_dict – Dictionary with registration parameters (optional)

Raises:

RuntimeError – If platform registration fails

read(context: steps.api.utils.CloudContext) dict[str][source]

Read this platform’s information from the cloud.

Parameters:

context – Cloud context for API configuration

Returns:

Dictionary with platform data from response

Raises:

RuntimeError – If reading platform data fails

update(context: steps.api.utils.CloudContext, update_dict: dict) None[source]

Update this platform’s information in the cloud.

Parameters:
  • context – Cloud context for API configuration

  • update_dict – Dictionary with fields to update

Raises:

RuntimeError – If updating platform data fails

delete(context: steps.api.utils.CloudContext) None[source]

Delete this platform from the cloud.

Parameters:

context – Cloud context for API configuration

Raises:

RuntimeError – If deleting the platform fails

fetch_job(context: steps.api.utils.CloudContext) steps.api.cloud_objects.cloud_job.Job[source]

Fetch a job for this platform to process.

Parameters:

context – Cloud context for API configuration

Returns:

Job object for the fetched job

Raises:

RuntimeError – If fetching a job fails

run_job(context: steps.api.utils.CloudContext, job) None[source]
progress_job(context: steps.api.utils.CloudContext, job, progress_dict: dict[str]) None[source]
finish_job(context: steps.api.utils.CloudContext, job, finish_dict: dict[str]) None[source]
assign_user(context: steps.api.utils.CloudContext, user: steps.api.cloud_objects.cloud_user.User) None[source]
assign_token(context: steps.api.utils.CloudContext, job_token) None[source]
assign_company(context: steps.api.utils.CloudContext, company_id: int) None[source]
classmethod list_all(context: steps.api.utils.CloudContext) list[Platform][source]

List all platforms in the cloud.

Parameters:

context – Cloud context for API configuration

Returns:

List of Platform objects

Raises:
  • AssertionError – If ADMIN is not an admin

  • RuntimeError – If listing platforms fails