https://pantsbuild.org/ logo
#general
Title
# general
r

ripe-gigabyte-88964

04/06/2023, 7:53 PM
I'm writing a plugin that will generate some artifacts that can be fed to a downstream deployment process. Configurations for these artifacts can either be specified in a custom target defined in the plugin, in a file referenced by the custom target, or some fields can have global defaults set in the subsystem. Is there a request I can use to get pants to run an arbitrary Python script in parallel for each
FieldSet
? Similar to
Process
except pants can run it in its own Python environment.
Also wondering how
compute_value
works for async fields? I have a field that I can derive a sensible default for but it could also be hydrated from the config file.
Also is there a specific exception or kind of exception I should throw if a certain value is neither specified nor can it be hydrated from the config file?
f

fast-nail-55400

04/06/2023, 9:22 PM
You can still use
Process
but have the binary be the Python interpreter available for rules to use which can be requested from the engine via the PythonBinary type.
And there are some examples in the Pants code base of adding an arbitrary Python script (via
CreateDigest
and
MergeDigests
) into the input root for a
Process
execution.
Setup the
Process
per
FieldSet
instance and then
MultiGet
the whole lot and you will have your concurrent execution.