google-cloud-platformgoogle-tasks-apigoogle-cloud-tasks

Google Cloud Tasks: Run a task before it's scheduled ETA


I have a use case where I schedule a task 24h into the future after an event occurs. This task represents some sort of "deadline" for other things to happen.

The scheduled task triggers a creation of a report. If not all of the above mentioned "other things" have completed by this time, then the triggered report creation process creates it anyways with the information it has at the time.

If, on the other hand, all other things do complete before these 24h, then ideally I'd like to re-use the same Google Cloud Task to trigger the same process (as it's identical as the previous case but will contain all of the information possible).

I would imagine the easiest way to achieve the above is to:

However, reading through the Google Cloud Tasks documentation I don't see the option to run the task early. However, that feature does exist on the Cloud Tasks console, so I was wondering if it is available in the documentation and client libraries.

Thanks!


Solution

  • This is probably what you're looking for

    https://cloud.google.com/tasks/docs/reference/rest/v2/projects.locations.queues.tasks/run

    NOTE: It does say however that "This command is meant to be used for manual debugging"