Skip to content

How should I be updating my Tasks for hera v5? #615

Answered by flaviuvadan
dmerrick asked this question in Q&A
Discussion options

You must be logged in to vote

Hey @dmerrick! Thanks for the question! If you want to maintain a structure that closely matches the example you can write something like:

from hera.workflows import Script, Workflow

def run_command(cmd: str) -> str:
  return cmd

task = Script(
  name="cmd-template",
  source=run_command,
  command=["bash"],
  image=docker_image,
  inputs=[Parameter(name="cmd", default="echo Hello Argo")],
)

If you want to take advantage of some of the new v5 features (single script example and Hera runner example):

from hera.workflows import script, Workflow

@script(image="docker_image", constructor="runner")  # you can also use GlobalHooks to set this! See example above 
def run_command(cmd: str = "e…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by elliotgunton
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
type:question A user question
2 participants
Converted from issue

This discussion was converted from issue #579 on May 04, 2023 18:53.