The GitHub Actions job "Tests ARM" on airflow.git/main has failed.
Run started by GitHub user potiuk (triggered by potiuk).

Head commit for run:
268ff81e3bfba41533fc895d6a1710aae71b8a57 / Ash Berlin-Taylor <[email protected]>
Change the interface by which Go tasks get access to variables etc. (#54743)

The previous approach (of a module function, and pulling the API client out of
context) was sort of thrown together, but on coming back to it with fresh eyes
I didn't like it for a couple of reasons:

1. It makes it harder to library consumers (i.e. Go task authors) to write
   unit tests of their task functions.

   Instead of being able to simply call the function with a mock that
   implements the right interface, they would have had to create a mock of the
   API client (which is lower level) and then put that in the context under
   the right Key -- all of which is too tightly coupled to the current
   implementation and shouldn't be exposed to users.

2. It was essentially using global variables.

   Now, we are still pulling the HTTP API client out of the Context, but that
   could very easily be changed in future to be stored as a field on the
   `client` struct.

3. By having the function accept an argument of Client interface it is much
   clearer what the function needs, and what it's doing.

   It is already an accepted pattern in Python that task functions get called
   with values for function arguments of "special" names (`ti` for example in
   python), so this is not a new pattern for us. This is similar to how
   Temporal support [passing arguments][1] to Activities (= our Tasks)

This PR doesn't introduce any new features, but sets us up to be add
Connection and XCom support in a future PR.

[1]: https://docs.temporal.io/develop/go/core-application#activity-parameters

Co-authored-by: Nick Stenning <[email protected]>

Report URL: https://github.com/apache/airflow/actions/runs/17416471120

With regards,
GitHub Actions via GitBox


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to