Managing the multiple organizations with InfluxDB OSS

I am using InfluxDB 2.0.3 OSS and trying to achieve multi-organization architecture with it.

I have created three organization configurations like below:

Org1 Org2 Org3
Input_bucket1 input_bucket2 input_bucket3
output_bucket1 output_bucket2 output_bucket3

input measurement, output measurement, and field names are common

I am trying to run one task which should run one time and take the values from the input bucket corresponding to the organization and put the data into the same organization output bucket.

f = (input_bucket, output_bucket, organization) =>
	(from(bucket: input_bucket)
    |> range(start: 2022-01-05T04:00:00Z,stop:2022-01-05T05:00:00Z)
    |> filter(fn: (r) => r["_measurement"] == input_measurement)
    |> filter(fn: (r) => r._field =="field_name")
    |> increase()
    |> last()
    |> drop(columns:["host"])
    |> map(fn: (r) =>
                ({
                        r with
                        time: r._time,
                        _measurement: output_measurement,
                        _field: "Output_field",
                        _value: float(v:r._value) / 1.0,
                }))
    |> timeShift(duration: -30m)
	|> to(bucket:output_bucket,org:organization,timeColumn:"time")
	)


f(input_bucket:"Input_bucket1",output_bucket:"output_bucket1",organization:"Org1")
f(input_bucket:"input_bucket2",output_bucket:"output_bucket2",organization:"Org2")
f(input_bucket:"input_bucket3",output_bucket:"output_bucket3",organization:"Org3")

Suppose I am running this task it shows input_bucket2 and input_bucket3 doesn’t exist. After doing more experiments I got to know I have to run three tasks belonging to each Orgs. This will lead to code duplication which will create extra overhead for us.

So, is there any way we can achieve this without having code duplication?

Thanks

@Anaisdg can I get any update on it?