Regular expression not detecting latest successful run for required operation dependency

According to the docs I can specify multiple supported operations for a required statement by using regular expressions

An example is also given

However whenever I try to selecting the latest run using regular expressions, for example using the following guild file


train-pull:
    main: script
    
train-extract:
    main: script

test:
  requires:
  - operation: ^train-

The latest successful run is not detected

guild: run failed because a dependency was not met: could not resolve 'operation:^train-' in ^train- resource: no suitable run for ^train-

If I specify the run id then the run is detected, but this seems to work regardless of if the passed run id is compatible with the regular expression given in the guild file.

Instead of this behavior I would expect guild to detect the latest run done for either train-pull or train-extract and use it as the operation requirement for test.

There’s a bug in the docs. The regex is a full match, not a starts-with. You need this:

test:
  requires:
  - operation: ^train-.+

Also, as a tip, you can include a name attribute to cleanup the interface to that requirement.

test:
  requires:
  - operation: ^train-.+
    name: train

This lets you specify a run ID for the dependency using a flag-like syntax:

guild run test train=<run ID>

Use whatever name makes most sense. I just picked train as an example.

Guild intentionally disregards the op requirement when you specify a full run ID. The rationale here is that if you’re specifying a full ID, you are intentionally overriding any specs in the Guild file. If you use a partial run ID, Guild uses the op requirement spec.

1 Like

Thanks for the quick reply, that worked perfectly.

1 Like