You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.
Currently there are 3 ways of triggering a job run:
Events
On a schedule
Externally (webhooks)
We've had multiple requests for a way to manually invoke a job, passing in a payload, and getting back a single run. This would work similarly to how our job test service works, but work via API and within another run.
Invoke Trigger
Jobs that can be manually invoked will use a new Trigger called invokeTrigger. This will work similarly to eventTrigger but won't have an event name:
Now that job can be manually invoked using a reference to the Job instance:
import{invokeExample1}from"./invoke";// This would return the run immediately, and can be used outside or inside of another job runconstrun=awaitinvokeExample1.invoke({name: "John"})// This would return the run after it's completed, and can only be used inside of another job run// If the invokeExample1 fails, the invocation task would fail. If it completes successfully, this would return the job output (typed correctly)constoutput=awaitinvokeExample1.invokeAndWait("invoke-job",{name: "John"})
Another benefit of having this manually invokable jobs is it would make it much more ergonomic to use with the useRunDetails React hook.
Implementation
This could work similarly to the TestJobService, where an event is created and then immediately used to create a new run, instead of going through the EventDispatcher system. The name of the event could be the job id, and the id of the event would either be randomly generated on the server, or the invocation task idempotency key when invoked from inside another job run.
Add a bulleted list, <Ctrl+Shift+8>Add a numbered list, <Ctrl+Shift+7>Add a task list, <Ctrl+Shift+l>
Directly mention a user or teamReference an issue or pull request
Add heading textAdd bold text, <Ctrl+b>Add italic text, <Ctrl+i>Add a bulleted list, <Ctrl+Shift+8>Add a numbered list, <Ctrl+Shift+7>Add a task list, <Ctrl+Shift+l>
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
{{title}}
-
Currently there are 3 ways of triggering a job run:
We've had multiple requests for a way to manually invoke a job, passing in a payload, and getting back a single run. This would work similarly to how our job test service works, but work via API and within another run.
Invoke Trigger
Jobs that can be manually invoked will use a new Trigger called
invokeTrigger. This will work similarly toeventTriggerbut won't have an event name:Now that job can be manually invoked using a reference to the
Jobinstance:Another benefit of having this manually invokable jobs is it would make it much more ergonomic to use with the useRunDetails React hook.
Implementation
This could work similarly to the
TestJobService, where an event is created and then immediately used to create a new run, instead of going through theEventDispatchersystem. The name of the event could be the job id, and theidof the event would either be randomly generated on the server, or the invocation task idempotency key when invoked from inside another job run.Beta Was this translation helpful? Give feedback.
All reactions