Hello, we would like for reference tasks to grab t...
# flyte-support
b
Hello, we would like for reference tasks to grab the latest version. The version parameter in the reference_task decorator is required, for our CICD we do not want to manually set this and our workflows and tasks are preregistered. I am able to grab the latest task version using FlyteRemote.
wrap the reference_task decorator? Not sure if thats possible
Copy code
@reference_task(
    project="myproject",
    domain="development",
    name="mytask.test",
    version="1234556",
)
a
Or am I not understanding what you are trying to achieve
b
a complete example would be more helpful. What are the prerequisites for the macro to work? The task and workflow are registered using pyflyte register,I get.
Copy code
Request rejected by the API, due to Invalid input.
RPC Failed, with Status: StatusCode.INVALID_ARGUMENT
a
@boundless-lifeguard-61788 looks like that macro is supported by
flytectl register
only at the time
b
The intention is the CICD to grab the latest version of reference tasks and workflows in a workflow. If I try
flytectl register
on my workflow which contains a reference task, it only works if I pass it the version which defeats what I am trying to do.
pyflyte --pkgs test package -f
flytectl register files --archive flyte-package.tgz --version "ADKDdgdgTEfg" -p test -d development
What would be the correct way for a CICD to fetch the latest task for a reference task
Copy code
@reference_task(
    project="test",
    domain="development",
    name="simple.print_date",
    version="{{ registration.version }}",
)
def print_date() -> str:   
    ...



@workflow
def test()-> str:
    return print_date()
The errors if I leave --version out
Copy code
Error: rpc error: code = InvalidArgument desc = missing version
{"json":{},"level":"error","msg":"rpc error: code = InvalidArgument desc = missing version"
and if I give it a new version
Copy code
version:\"1\"] with err missing entity of type TASK with identifier project:\"test\"  domain:\"development\"  name:\"simple.print_date\"  version:\"1\""
and if I take out the reference task and use a ask defined in the workflow (a normal task) it works with a new version
flytectl register files --archive flyte-package.tgz --version "1" -p test -d development