Пример #1
0
    def fetch_latest(cls, project, domain, name):
        """
        This function uses the engine loader to call create a latest hydrated task from Admin.
        :param Text project:
        :param Text domain:
        :param Text name:
        :rtype: SdkTask
        """
        named_task = _common_model.NamedEntityIdentifier(project, domain, name)
        client = _flyte_engine.get_client()
        task_list, _ = client.list_tasks_paginated(
            named_task,
            limit=1,
            sort_by=_admin_common.Sort(
                "created_at", _admin_common.Sort.Direction.DESCENDING),
        )
        admin_task = task_list[0] if task_list else None

        if not admin_task:
            raise _user_exceptions.FlyteEntityNotExistException(
                "Named task {} not found".format(named_task))
        sdk_task = cls.promote_from_model(
            admin_task.closure.compiled_task.template)
        sdk_task._id = admin_task.id
        return sdk_task
Пример #2
0
 def fetch_latest(cls, project, domain, name):
     """
     This function uses the engine loader to call create a latest hydrated task from Admin.
     :param Text project:
     :param Text domain:
     :param Text name:
     :rtype: SdkTask
     """
     named_task = _common_model.NamedEntityIdentifier(project, domain, name)
     admin_task = _engine_loader.get_engine().fetch_latest_task(named_task)
     if not admin_task:
         raise _user_exceptions.FlyteEntityNotExistException("Named task {} not found".format(named_task))
     sdk_task = cls.promote_from_model(admin_task.closure.compiled_task.template)
     sdk_task._id = admin_task.id
     return sdk_task