예제 #1
0
def test_hydrate_registration_parameters__launch_plan_nothing_set():
    launch_plan = _launch_plan_pb2.LaunchPlan(
        id=_identifier_pb2.Identifier(
            resource_type=_identifier_pb2.LAUNCH_PLAN,
            name="lp_name",
        ),
        spec=_launch_plan_pb2.LaunchPlanSpec(
            workflow_id=_identifier_pb2.Identifier(
                resource_type=_identifier_pb2.WORKFLOW,
                name="workflow_name",
            )),
    )
    identifier, entity = hydrate_registration_parameters(
        _identifier_pb2.LAUNCH_PLAN,
        "project",
        "domain",
        "12345",
        launch_plan,
    )
    assert identifier == _identifier_pb2.Identifier(
        resource_type=_identifier_pb2.LAUNCH_PLAN,
        project="project",
        domain="domain",
        name="lp_name",
        version="12345",
    )
    assert entity.spec.workflow_id == _identifier_pb2.Identifier(
        resource_type=_identifier_pb2.WORKFLOW,
        project="project",
        domain="domain",
        name="workflow_name",
        version="12345",
    )
예제 #2
0
 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())
예제 #3
0
 def to_flyte_idl(self):
     """
     :rtype: flyteidl.admin.launch_plan_pb2.LaunchPlan
     """
     identifier = (
         self.id if self.id is not None else _identifier.Identifier(
             _identifier.ResourceType.LAUNCH_PLAN, None, None, None, None))
     return _launch_plan.LaunchPlan(
         id=identifier.to_flyte_idl(),
         spec=self.spec.to_flyte_idl(),
         closure=self.closure.to_flyte_idl(),
     )