How to use the flyteidl.admin.launch_plan_pb2 function in flyteidl

To help you get started, we’ve selected a few flyteidl examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github lyft / flytekit / flytekit / clients / friendly.py View on Github external
the database must match the existing definition exactly.  This also means that as long as the request
            remains identical, calling this method multiple times will result in success.

        :param: flytekit.models.core.identifier.Identifier launch_plan_identifer: The identifier for this launch plan.
        :param: Text version: The version identifier of this launch plan. Used to distinguish between different
            iterations of tasks with the same name. If any aspect of the underlying launch plan definition changes,
            then the version must also change to be accepted by the Flyte Admin Service.
        :param: flytekit.models.launch_plan.LaunchPlanSpec launch_plan_spec: This is the actual definition of the
            launch plan that should be created.
        :raises flytekit.common.exceptions.user.FlyteEntityAlreadyExistsException: If an identical version of the
            launch plan is found, this exception is raised.  The client might choose to ignore this exception because
            the identical launch plan is already registered.
        :raises grpc.RpcError:
        """
        super(SynchronousFlyteClient, self).create_launch_plan(
            _launch_plan_pb2.LaunchPlanCreateRequest(
                id=launch_plan_identifer.to_flyte_idl(),
                spec=launch_plan_spec.to_flyte_idl()
            )
github lyft / flytekit / flytekit / models / launch_plan.py View on Github external
def to_flyte_idl(self):
        """
        :rtype: flyteidl.admin.launch_plan_pb2.LaunchPlanSpec
        """
        return _launch_plan.LaunchPlanSpec(
            workflow_id=self.workflow_id.to_flyte_idl(),
            entity_metadata=self.entity_metadata.to_flyte_idl(),
            default_inputs=self.default_inputs.to_flyte_idl(),
            fixed_inputs=self.fixed_inputs.to_flyte_idl(),
            labels=self.labels.to_flyte_idl(),
            annotations=self.annotations.to_flyte_idl(),
            auth=self.auth.to_flyte_idl(),
        )
github lyft / flytekit / flytekit / models / launch_plan.py View on Github external
def to_flyte_idl(self):
        """
        :rtype: flyteidl.admin.launch_plan_pb2.LaunchPlan
        """
        return _launch_plan.LaunchPlan(
            id=self.id.to_flyte_idl(),
            spec=self.spec.to_flyte_idl(),
            closure=self.closure.to_flyte_idl()
        )
github lyft / flytekit / flytekit / models / launch_plan.py View on Github external
:param flyteidl.admin.launch_plan_pb2.LaunchPlanSpec pb2_object:
        :rtype: LaunchPlanSpec
        """
        return cls(
            workflow_id=_identifier.Identifier.from_flyte_idl(pb2_object.workflow_id),
            entity_metadata=LaunchPlanMetadata.from_flyte_idl(pb2_object.entity_metadata),
            default_inputs=_interface.ParameterMap.from_flyte_idl(pb2_object.default_inputs),
            fixed_inputs=_literals.LiteralMap.from_flyte_idl(pb2_object.fixed_inputs),
            labels=_common.Labels.from_flyte_idl(pb2_object.labels),
            annotations=_common.Annotations.from_flyte_idl(pb2_object.annotations),
            auth=Auth.from_flyte_idl(pb2_object.auth),
        )


class LaunchPlanState(object):
    INACTIVE = _launch_plan.INACTIVE
    ACTIVE = _launch_plan.ACTIVE

    @classmethod
    def enum_to_string(cls, val):
        """
        :param int val:
        :rtype: Text
        """
        if val == cls.INACTIVE:
            return "INACTIVE"
        elif val == cls.ACTIVE:
            return "ACTIVE"
        else:
            return ""

github lyft / flytekit / flytekit / clis / flyte_cli / main.py View on Github external
:param files:
    :return:
    """
    _welcome_message()
    client = _friendly_client.SynchronousFlyteClient(host, insecure=insecure)
    files = list(files)
    files.sort()
    _click.secho("Parsing files...", fg='green', bold=True)
    for f in files:
        _click.echo(f"  {f}")

    flyte_entities_list = _extract_files(files)
    for id, flyte_entity in flyte_entities_list:
        try:
            if id.resource_type == _identifier_pb2.LAUNCH_PLAN:
                client.raw.create_launch_plan(_launch_plan_pb2.LaunchPlanCreateRequest(id=id, spec=flyte_entity))
            elif id.resource_type == _identifier_pb2.TASK:
                client.raw.create_task(_task_pb2.TaskCreateRequest(id=id, spec=flyte_entity))
            elif id.resource_type == _identifier_pb2.WORKFLOW:
                client.raw.create_workflow(_workflow_pb2.WorkflowCreateRequest(id=id, spec=flyte_entity))
            else:
                raise _user_exceptions.FlyteAssertion(f"Only tasks, launch plans, and workflows can be called with this function, "
                                      f"resource type {id.resource_type} was passed")
            _click.secho(f"Registered {id}", fg='green')
        except _user_exceptions.FlyteEntityAlreadyExistsException:
            _click.secho(f"Skipping because already registered {id}", fg='cyan')

    _click.echo(f"Finished scanning {len(flyte_entities_list)} files")
github lyft / flytekit / flytekit / models / launch_plan.py View on Github external
:rtype: LaunchPlanSpec
        """
        return cls(
            workflow_id=_identifier.Identifier.from_flyte_idl(pb2_object.workflow_id),
            entity_metadata=LaunchPlanMetadata.from_flyte_idl(pb2_object.entity_metadata),
            default_inputs=_interface.ParameterMap.from_flyte_idl(pb2_object.default_inputs),
            fixed_inputs=_literals.LiteralMap.from_flyte_idl(pb2_object.fixed_inputs),
            labels=_common.Labels.from_flyte_idl(pb2_object.labels),
            annotations=_common.Annotations.from_flyte_idl(pb2_object.annotations),
            auth=Auth.from_flyte_idl(pb2_object.auth),
        )


class LaunchPlanState(object):
    INACTIVE = _launch_plan.INACTIVE
    ACTIVE = _launch_plan.ACTIVE

    @classmethod
    def enum_to_string(cls, val):
        """
        :param int val:
        :rtype: Text
        """
        if val == cls.INACTIVE:
            return "INACTIVE"
        elif val == cls.ACTIVE:
            return "ACTIVE"
        else:
            return ""


class LaunchPlanClosure(_common.FlyteIdlEntity):
github lyft / flytekit / flytekit / models / launch_plan.py View on Github external
def to_flyte_idl(self):
        """
        List of notifications based on Execution status transitions
        :rtype: flyteidl.admin.launch_plan_pb2.LaunchPlanMetadata
        """
        return _launch_plan.LaunchPlanMetadata(
            schedule=self.schedule.to_flyte_idl() if self.schedule is not None else None,
            notifications=[n.to_flyte_idl() for n in self.notifications]
        )
github lyft / flytekit / flytekit / clients / friendly.py View on Github external
def get_active_launch_plan(self, identifier):
        """
        Retrieves the active launch plan entity given a named entity identifier (project, domain, name).  Raises an
        error if no active launch plan exists.

        :param flytekit.models.common.NamedEntityIdentifier identifier: NamedEntityIdentifier to list.
        :rtype: flytekit.models.launch_plan.LaunchPlan
        """
        return _launch_plan.LaunchPlan.from_flyte_idl(
            super(SynchronousFlyteClient, self).get_active_launch_plan(
                _launch_plan_pb2.ActiveLaunchPlanRequest(
                    id=identifier.to_flyte_idl()
                )
github lyft / flytekit / flytekit / models / launch_plan.py View on Github external
def to_flyte_idl(self):
        """
        :rtype: flyteidl.admin.launch_plan_pb2.LaunchPlanClosure
        """
        return _launch_plan.LaunchPlanClosure(
            state=self.state,
            expected_inputs=self.expected_inputs.to_flyte_idl(),
            expected_outputs=self.expected_outputs.to_flyte_idl(),
        )