Add consumableResources process directive for AWS Batch#6957
Add consumableResources process directive for AWS Batch#6957
Conversation
✅ Deploy Preview for nextflow-docs-staging canceled.
|
|
i'd prefer mapping this to a custom resource label instead of introducing yet another directive |
|
Re: resource labels - interesting approach. |
|
@pditommaso if we implement this with a resource label, we'll have to think about how to namespace it properly. Let me know what you think: // alt 1
resourceLabels 'consumable-resource:my-dragen-license': 1
// alt 2
resourceLabels 'consumable-resource': 'my-dragen-license=1' |
|
Maybe more the second, tho don't have a strong opinion, we should eval pros & cons of different syntax, including the need for sched. Another option to avoid overloading the |
|
I really like the idea of a |
|
I'd definitely prefer |
|
🙌 |
|
If @bentsherman or @pditommaso give me a 👍 on this comment, I'll move this PR to |
|
Feel free to draft as non-binding. It'd be good to draft a spec/adr separately to "formalise" the new directive name/syntax etc. |
|
** separately ** 😄 |
|
Hahaha. I'll pull back the ADR and limit this PR to just the (draft) implementation ADR (with real human input) for discussion: #6960 |
Add field, builder method, getter, and wire into toBatchRequest() for AWS Batch consumable resource support. Ref: #5917 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Rob Syme <rob.syme@gmail.com>
Register 'consumableResources' in the DIRECTIVES list and add handler methods for string shorthand (implies quantity 1) and map syntax. Repeatable — multiple calls accumulate into a ConfigList. Ref: #5917 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Rob Syme <rob.syme@gmail.com>
Normalizes both DSL-accumulated ConfigList (list of [name, quantity] pairs) and config-provided Map syntax into a uniform List<List> representation. Ref: #5917 Signed-off-by: Rob Syme <rob.syme@gmail.com>
Map the consumableResources process directive to ConsumableResourceProperties on RegisterJobDefinitionRequest. Include consumable resources in the job definition hash to ensure different resource configurations produce distinct job definitions. Ref: #5917 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Rob Syme <rob.syme@gmail.com>
Document the new directive in the process reference with syntax examples (string shorthand, map, repeatable), FIFO queue ordering caveat, and AWS prerequisites. Add to the AWS Batch executor's supported directives list. Ref: #5917 Signed-off-by: Rob Syme <rob.syme@gmail.com>
Register consumableResources in ProcessDsl.DirectiveDsl so the config validator recognizes process.consumableResources. Handle plain String input in TaskConfig.getConsumableResources() (e.g. from config `process.consumableResources = 'my-license'`) by treating it as quantity 1, matching the DSL shorthand behavior. Ref: #5917 Signed-off-by: Rob Syme <rob.syme@gmail.com>
Replace the narrow consumableResources directive with a generic hints directive that uses namespaced keys. The hints directive accepts a map and is repeatable (multiple calls merge), following the resourceLabels pattern. The AWS Batch executor consumes consumable-resource:* prefixed hints and maps them to ConsumableResourceProperties on the job definition. Non-matching hints are silently ignored. Syntax: hints 'consumable-resource:my-license': 1 Config: process.hints = ['consumable-resource:my-license': 1] Ref: #5917 Signed-off-by: Rob Syme <rob.syme@gmail.com>
5e88d83 to
66a336a
Compare


Summary
consumableResourcesprocess directive that maps to AWS Batch resource-aware schedulingconsumableResources 'my-license'implies quantity 1), map syntax (consumableResources 'lic': 2), and is repeatable across multiple callsUsage
Implementation
ProcessBuilder.DIRECTIVES, handler methods for string/map syntax withConfigListaccumulation,TaskConfig.getConsumableResources()getter normalizing all input formsProcessDsl.DirectiveDslupdated for config validationAwsBatchTaskHandler.configJobDefRequest()maps directive toConsumableResourcePropertiesonRegisterJobDefinitionRequestviaRegisterJobDefinitionModel; included in job definition hashdocs/reference/process.mdwith FIFO queue ordering caveat; added to AWS Batch executor's supported directives listCloses #5917
Test plan
ProcessBuilderTest— string shorthand, map syntax, multi-resource, repeatable accumulationTaskConfigTest— Map normalization, List passthrough, String shorthand, null handlingAwsBatchTaskHandlerTest— single resource, multiple resources, absent directive, hashing, no regression on existing tests🤖 Generated with Claude Code