I wrote a `fmt` plugin where a pex process should ...
# plugins
p
I wrote a
fmt
plugin where a pex process should run once for every instance of my custom
schemas
target. So far, I've only had this target in one place, but I figured I'd go ahead and make it do The Right Thing ™️ , and get rid of the assumption that there is only ever one instance of this target. But,
FmtResult
expects there to be only one
ProcessResult
. So, is there a way to (a) make sure pants runs my fmt rule separately for each target instance; or (b) combine multiple
ProcessResults
into one; or (c) something I haven't considered. Here is the relevant section of code: https://github.com/StackStorm/st2/blob/04302f30e1301db50c441beb697812c2d5cc99cc/pants-plugins/schemas/rules.py#L82-L108
b
• Each time your fmt rule is invoked with a field set for a single target • You don't have to use
.create
, that's just for convenience
p
Each time your fmt rule is invoked with a field set for a single target
fmt always does one target at a time?
You don't have to use
.create
, that's just for convenience
Oh. Good point. Thanks.
b
Fmt always does one target at a time?
For now, yup! Eventually, also yup
p
So
len(FmtRequest.field_sets) == 1
Then why is it called
field_sets
?
👀 1
b
Oh wow yeah I'm completely off my rocker, wtf
Sorry, travel brain. So you could make this work in pants 2.15 by having the partitioner return N partitions if one element
p
Ah. I'm in 2.14
I guess there are a lot of fmt changes in newer versions.
b
So yeah in 2.14 just hand-craft a result by looking at the results of your processes