steps.api.cloud_objects.cloud_platform ====================================== .. py:module:: steps.api.cloud_objects.cloud_platform Classes ------- .. autoapisummary:: steps.api.cloud_objects.cloud_platform.Platform Module Contents --------------- .. py:class:: Platform(name: str = '', type: str = 'simulator', platform_id: str = None, worker_id: str = str(uuid4()), specs: dict[str] = {'available_commands': ['probs']}, **kwargs) Bases: :py:obj:`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. :param name: Name of the platform :param type: Type of platform (default: "simulator") :param platform_id: Platform ID (None for new platforms) :param worker_id: Worker ID (defaults to a new UUID) :param specs: Platform specifications :param kwargs: Additional attributes to set on the platform :raises AssertionError: If Platform.ADMIN is None or not an admin .. py:attribute:: ADMIN :value: None .. py:attribute:: REGISTER_ENDPOINT :value: '/admin/platforms/register' .. py:attribute:: JOB_ENDPOINT :value: '/admin/job' .. py:attribute:: ASSIGN_ENDPOINT :value: '/api/platform-permissions' .. py:method:: get_object_name() -> str :classmethod: .. py:method:: get_endpoint() -> str :classmethod: .. py:method:: get_api(context: steps.api.utils.CloudContext) -> steps.api.utils.Api :classmethod: .. py:method:: get_token_method() -> str :classmethod: .. py:attribute:: PLATFORM_NAME_KEY :value: 'platform_name' .. py:attribute:: DEFAULT_NAME :value: 'sim:qa' .. py:attribute:: name :value: '' .. py:attribute:: type :value: 'simulator' .. py:attribute:: worker_id :type: str :value: '' .. py:attribute:: platform_id :type: str .. py:attribute:: specs .. py:method:: register(context: steps.api.utils.CloudContext, register_dict: dict[str] = None) -> None Register this platform in the cloud. :param context: Cloud context for API configuration :param register_dict: Dictionary with registration parameters (optional) :raises RuntimeError: If platform registration fails .. py:method:: read(context: steps.api.utils.CloudContext) -> dict[str] Read this platform's information from the cloud. :param context: Cloud context for API configuration :return: Dictionary with platform data from response :raises RuntimeError: If reading platform data fails .. py:method:: update(context: steps.api.utils.CloudContext, update_dict: dict) -> None Update this platform's information in the cloud. :param context: Cloud context for API configuration :param update_dict: Dictionary with fields to update :raises RuntimeError: If updating platform data fails .. py:method:: delete(context: steps.api.utils.CloudContext) -> None Delete this platform from the cloud. :param context: Cloud context for API configuration :raises RuntimeError: If deleting the platform fails .. py:method:: fetch_job(context: steps.api.utils.CloudContext) -> steps.api.cloud_objects.cloud_job.Job Fetch a job for this platform to process. :param context: Cloud context for API configuration :return: Job object for the fetched job :raises RuntimeError: If fetching a job fails .. py:method:: run_job(context: steps.api.utils.CloudContext, job) -> None .. py:method:: progress_job(context: steps.api.utils.CloudContext, job, progress_dict: dict[str]) -> None .. py:method:: finish_job(context: steps.api.utils.CloudContext, job, finish_dict: dict[str]) -> None .. py:method:: assign_user(context: steps.api.utils.CloudContext, user: steps.api.cloud_objects.cloud_user.User) -> None .. py:method:: assign_token(context: steps.api.utils.CloudContext, job_token) -> None .. py:method:: assign_company(context: steps.api.utils.CloudContext, company_id: int) -> None .. py:method:: list_all(context: steps.api.utils.CloudContext) -> list[Platform] :classmethod: List all platforms in the cloud. :param context: Cloud context for API configuration :return: List of Platform objects :raises AssertionError: If ADMIN is not an admin :raises RuntimeError: If listing platforms fails