OrchardCMS / OrchardCore

Orchard Core is an open-source modular and multi-tenant application framework built with ASP.NET Core, and a content management system (CMS) built on top of that framework.
https://orchardcore.net
BSD 3-Clause "New" or "Revised" License
7.41k stars 2.39k forks source link

Add insights into the backgrounds tasks #13070

Open MikeAlhayek opened 1 year ago

MikeAlhayek commented 1 year ago

Is your feature request related to a problem? Please describe.

Currently, there is no way to tell the status of the background task or it's run history. I think it's very helpful to show information about the running instance of the background. For example,

  1. What is the date/time of the last run time.
  2. When will the task run next.
  3. Current status "Running", "Ready", "Disabled"
  4. Was the last time the job ran successful?

Also, it would be helpful to show on the list view "in plain language" the schedule. For example, if the schedule is set to */2 * * * * we would show something like "Schedule to run every 2 minutes".

Also, it would be nice to be able to trigger the background task manually if needed.

jtkech commented 1 year ago

Yes, at the very beginning I added some states but @sebastienros wanted to keep it minimalist.

Otherwise states would need to be shared (e.g. if multiple running instances), we have the volatile document manager allowing to share data without storage persistance.

sebastienros commented 1 year ago

We don't have these in background tasks because they are made to be run on every node of the cluster. When you go in the admin there is no way to get the status of each node for this background task as we do not share their states, or have a list of all the nodes.

We also worked on Jobs (@jtkech was that the name?) which are tasks that can be executed by any node, but only once, and we can keep the status of these jobs in database.

Maybe we could add some structured log for these background tasks, with a reference to the node identity (something to add? in a configuration file?). We could then list all the events for any background tasks. We might already have a default implementation for node identity not based on configuration but using the machine name.

jtkech commented 1 year ago

@jtkech was that the name?

Yes

sebastienros commented 1 year ago

@jtkech and did we ship it?

jtkech commented 1 year ago

@jtkech and did we ship it?

No, we only defined partially what could be done ;)