Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Context-aware retries using previous resource requirements. #696

Open
claymcleod opened this issue Jan 16, 2025 · 3 comments
Open

Context-aware retries using previous resource requirements. #696

claymcleod opened this issue Jan 16, 2025 · 3 comments

Comments

@claymcleod
Copy link
Collaborator

It would be really useful to reference parameters from previous runs upon retry. For example, if you'd like to keep retrying a job up until a particular limit until it succeeds, it would could theoretically be expressed like this.

task foo {
  command <<<
    echo "do some work"
  >>>

  requirements {
    memory: if task.iteration > 0 {
      task.previous.memory * 2
    } else {
      # 2 GB
      2000000000
    }
  }
}

In other words, if this is the first iteration of the task, start with 2 GB. Otherwise, take the previous task requirement and double it. I'm curious if this is something that might be generally useful when building robust task implementations.

Open Questions

  • Should only the last task requirement be kept as task.previous (or similar), or should there be, say, an array of task requirements from previous attempts?
@claymcleod claymcleod changed the title Context-aware retries using the task variable. Context-aware retries using previous resource requirements. Jan 16, 2025
@claymcleod
Copy link
Collaborator Author

I realized upon a closer reading of the specification that this is already supported through the attempt variable in the task scope: https://github.com/openwdl/wdl/blob/wdl-1.2/SPEC.md#runtime-access-to-requirements-hints-and-metadata.

@claymcleod
Copy link
Collaborator Author

Opening this again because @peterhuene pointed out to me that task is only accessible in output and command blocks.

@claymcleod claymcleod reopened this Feb 1, 2025
@peterhuene
Copy link
Contributor

To fix this, I suggest we expand the hidden task scope to include evaluation of requirements, hints, and runtime sections.

Additionally, we change the types of the following task variable fields to optional with an initial value of None while evaluating the requirements, hints, and runtime sections:

  • container -> String?
  • cpu -> Float?
  • memory -> Int?
  • gpu -> Array[String]?
  • fpga -> Array[String]?
  • disks -> Map[String, Int]?

Personally, I think such a change would be relatively backwards compatible with what's in 1.2.0 and could be fixed in a 1.2.1 release of the spec without having to wait for 1.3.0 to enable this functionality.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants