octue / django-gcp

Everything required to run Django on GCP (storage, pubsub events, tasks, logging, errors)
Other
19 stars 3 forks source link

Add setting to allow for task disabling #34

Closed nvn-nil closed 1 year ago

nvn-nil commented 1 year ago

Feature request

Use Case

We need to add a new setting called GCP_TASKS_DISABLE_EXECUTION that allows us to turn off task execution when necessary. This new setting should be a boolean that defaults to False and can be set to True to disable task execution.

This will allow us to control task execution more precisely, which can be very useful for testing and debugging.

Current state

Currently, there is no mechanism available to disable the execution of tasks at a global level. As a workaround, we need to patch calls to the enqueue() method every time we use a task in a testing scenario. This approach poses a challenge while testing large systems with numerous tasks as we need to repeatedly patch the enqueue() method, causing increased overhead and reduced productivity.