How to use the flyteidl.core.identifier_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 / clis / flyte_cli / main.py View on Github external
def _extract_pair(identifier_file, object_file):
    """
    :param Text identifier_file:
    :param Text object_file:
    :rtype: (flyteidl.core.identifier_pb2.Identifier, T)
    """
    resource_map = {
        _identifier_pb2.LAUNCH_PLAN: _launch_plan_pb2.LaunchPlanSpec,
        _identifier_pb2.WORKFLOW: _workflow_pb2.WorkflowSpec,
        _identifier_pb2.TASK: _task_pb2.TaskSpec
    }
    id = _load_proto_from_file(_identifier_pb2.Identifier, identifier_file)
    if not id.resource_type in resource_map:
        raise _user_exceptions.FlyteAssertion(f"Resource type found in identifier {id.resource_type} invalid, must be launch plan, "
                              f"task, or workflow")
    entity = _load_proto_from_file(resource_map[id.resource_type], object_file)
    return id, entity
github lyft / flytekit / flytekit / clis / flyte_cli / main.py View on Github external
def _extract_pair(identifier_file, object_file):
    """
    :param Text identifier_file:
    :param Text object_file:
    :rtype: (flyteidl.core.identifier_pb2.Identifier, T)
    """
    resource_map = {
        _identifier_pb2.LAUNCH_PLAN: _launch_plan_pb2.LaunchPlanSpec,
        _identifier_pb2.WORKFLOW: _workflow_pb2.WorkflowSpec,
        _identifier_pb2.TASK: _task_pb2.TaskSpec
    }
    id = _load_proto_from_file(_identifier_pb2.Identifier, identifier_file)
    if not id.resource_type in resource_map:
        raise _user_exceptions.FlyteAssertion(f"Resource type found in identifier {id.resource_type} invalid, must be launch plan, "
                              f"task, or workflow")
    entity = _load_proto_from_file(resource_map[id.resource_type], object_file)
    return id, entity
github lyft / flytekit / flytekit / models / core / identifier.py View on Github external
from __future__ import absolute_import
from flytekit.models import common as _common_models
from flyteidl.core import identifier_pb2 as _identifier_pb2


class ResourceType(object):
    UNSPECIFIED = _identifier_pb2.UNSPECIFIED
    TASK = _identifier_pb2.TASK
    WORKFLOW = _identifier_pb2.WORKFLOW
    LAUNCH_PLAN = _identifier_pb2.LAUNCH_PLAN


class Identifier(_common_models.FlyteIdlEntity):

    def __init__(self, resource_type, project, domain, name, version):
        """
        :param int resource_type: enum value from ResourceType
        :param Text project:
        :param Text domain:
        :param Text name:
        :param Text version:
        """
        self._resource_type = resource_type
        self._project = project
        self._domain = domain
        self._name = name
github lyft / flytekit / flytekit / models / core / identifier.py View on Github external
from __future__ import absolute_import
from flytekit.models import common as _common_models
from flyteidl.core import identifier_pb2 as _identifier_pb2


class ResourceType(object):
    UNSPECIFIED = _identifier_pb2.UNSPECIFIED
    TASK = _identifier_pb2.TASK
    WORKFLOW = _identifier_pb2.WORKFLOW
    LAUNCH_PLAN = _identifier_pb2.LAUNCH_PLAN


class Identifier(_common_models.FlyteIdlEntity):

    def __init__(self, resource_type, project, domain, name, version):
        """
        :param int resource_type: enum value from ResourceType
        :param Text project:
        :param Text domain:
        :param Text name:
        :param Text version:
        """
        self._resource_type = resource_type
github lyft / flytekit / flytekit / models / core / identifier.py View on Github external
def to_flyte_idl(self):
        """
        :rtype: flyteidl.core.identifier_pb2.TaskExecutionIdentifier
        """
        return _identifier_pb2.TaskExecutionIdentifier(
            task_id=self.task_id.to_flyte_idl(),
            node_execution_id=self.node_execution_id.to_flyte_idl(),
            retry_attempt=self.retry_attempt
        )
github lyft / flytekit / flytekit / models / core / identifier.py View on Github external
def to_flyte_idl(self):
        """
        :rtype: flyteidl.core.identifier_pb2.WorkflowExecutionIdentifier
        """
        return _identifier_pb2.WorkflowExecutionIdentifier(
            project=self.project,
            domain=self.domain,
            name=self.name,
        )
github lyft / flytekit / flytekit / models / core / identifier.py View on Github external
def to_flyte_idl(self):
        """
        :rtype: flyteidl.core.identifier_pb2.NodeExecutionIdentifier
        """
        return _identifier_pb2.NodeExecutionIdentifier(
            node_id=self.node_id,
            execution_id=self.execution_id.to_flyte_idl(),
        )
github lyft / flytekit / flytekit / models / core / identifier.py View on Github external
def to_flyte_idl(self):
        """
        :rtype: flyteidl.core.identifier_pb2.Identifier
        """
        return _identifier_pb2.Identifier(
            resource_type=self.resource_type,
            project=self.project,
            domain=self.domain,
            name=self.name,
            version=self.version
        )