symbiote / silverstripe-queuedjobs

A module that provides interfaces for scheduling jobs for certain times.
BSD 3-Clause "New" or "Revised" License
57 stars 73 forks source link

onBefore/After actions #412

Closed Firesphere closed 9 months ago

Firesphere commented 10 months ago

I'd like to have the option to hook in to the automated run (ProcessJobQueueTask), to execute certain checks before and after a task is/has run.

I don't want to add this to every task, as I am looking at a generic approach that can be plug-and-play for whatever job others create.

GuySartorelli commented 9 months ago

Hi, Sorry, but I'm struggling to understand exactly what you're after here... you seem to be using the words "task" and "job" interchangeably - or at least that's how I'm interpreting this.

Do you want extension hooks before and after the ProcessJobQueueTask itself runs? Or do you want extension hooks before and after each job runs? Or... something else?

If it's before and after each job, I believe there are already extension hooks for after jobs have been run but I'd support a pull request that introduces a new extension hook for before a job is run.

If it's before and after the ProcessJobQueueTask runs, this may be better served with extension points being added to the TaskRunner in silverstripe/framework (i.e. call extend('beforeRun') and extend('afterRun') on the BuildTask instance before and after the runner calls run() on it). If that's the case, again I'd support a pull request being raised for that.

GuySartorelli commented 9 months ago

Closing due to lack of response. Depending on what was being requested, it might already be implemented or there might be a better alternative, but it's hard to know without more information.