<#3386 [BUG] Multiple definitions of the following...
# flytekit
a
#3386 [BUG] Multiple definitions of the following tasks were found error for remote tasks Issue created by sonjaer Describe the bug When running
pyflyte package
, we get an error like:
Copy code
Multiple definitions of the following tasks were found: ['ShiftDatetimeByDurationTaskV0', 'LookupFixedRangeBigQueryTaskV1', 'LookupBigQueryTaskV1']
where those tasks are remote tasks used within a workflow. The error is introduced In flytekit versions after 1.2.7 (probably 1.2.8) and is maybe due to that
_should_register_with_admin
function no longer filters out remote tasks entities as FlyteTask superclass changed from:
Copy code
class FlyteTask(hash_mixin.HashOnReferenceMixin, RemoteEntity, _task_model.TaskTemplate):
to
Copy code
class FlyteTask(hash_mixin.HashOnReferenceMixin, RemoteEntity, TaskSpec):
Copy code
def _should_register_with_admin(entity) -> bool:
    """
    This is used in the code below. The translator.py module produces lots of objects (namely nodes and BranchNodes)
    that do not/should not be written to .pb file to send to admin. This function filters them out.
    """
    return isinstance(
        entity, (task_models.TaskSpec, _launch_plan_models.LaunchPlan, admin_workflow_models.WorkflowSpec)
    )
Expected behavior Should not get an error of duplicate tasks defined for remote tasks when running pyflyte package Additional context to reproduce No response Screenshots No response Are you sure this issue hasn't been raised already? ☑︎ Yes Have you read the Code of Conduct? ☑︎ Yes flyteorg/flyte