November Happy Hour will be moved to Thursday December 5th.

Most of my EPiServer job are not showing in Admin

Vote:
 

I have almost 50 projects in my solution. One of those is for EPiServer Admin. I have most of my projects under a parent project and that parent project is part of my EPiAdmin project. Mostof these child projects have EPiServer job. These child project jobs are not showing within EPiServer Admin under Scheduled Jobs. How do I make these show up?

EPiAdmin Project

-- Dependencies

    -- Projects

      -- Parent Project

        -- Child Project 1 with epi jobs

        -- Child Project 2 with epi jobs

        -- Child Project 3 with epi jobs

#319484
Mar 25, 2024 18:20
Vote:
 

Can you post the definition of the jobs here to see if they are properly defined?

Also can you check tblScheduledItem to see if they are enabled? (Enabled column = true)

#319525
Mar 26, 2024 11:01
Vote:
 

Here is one. They do work if called via API. All the jobs are in tblScheduledItem table and are enabled.

/// <summary>
/// Start Service Import Job From Code
/// GUID = "2F21F473-31F0-4A5C-804A-8DD511E38E72"
/// </summary>
/// <returns></returns>
public IActionResult StartServiceImportEpiJobFromCode()
{
    string message = StartScheduledJob(Id: new Guid("2F21F473-31F0-4A5C-804A-8DD511E38E72")).ToString();
    DisplayMessageAfterRedirect(message);
    return RedirectToAction("Index");
}

/// <summary>
/// Import Services from EPiServer
/// </summary>
[EPiServer.PlugIn.ScheduledPlugIn(DisplayName = "Service Import",
                                  Description = "Service Import",
                                  GUID = "2F21F473-31F0-4A5C-804A-8DD511E38E72",
                                  DefaultEnabled = true,
                                  Restartable = true,
                                  SortIndex = 1000)]
#319536
Mar 26, 2024 13:04
Vote:
 

Found out some more info. We had added [assembly: EPiServer.Framework.PreventAssemblyScan] to most of out projects to decrease the amount of memory. By do this, we decreased memory usage by 200%. Now just need to add those projects back in that have scheduled tasks. Maybe someone knows of a way I can manually add those jobs back in without have them scan our projects and use so much memory.

#319546
Edited, Mar 26, 2024 22:28
Vote:
 

Then it would make senses to have a separate project with scheduled jobs only ...

#319583
Mar 27, 2024 7:11
Vote:
 

Interesting challenge, Eric.

The framework automatically scans the assemblies for scheduled jobs and then synchronizes them to the database. Now, since you disabled scanning of assemblies that does not work.

I guess you could manually synchronize the jobs to the database in each project that contains jobs. Although it will contain some boilerplate code, as the synchronization is internal and you would need to reimplement it in your own code (maybe in a common utility project).

I am not sure if initialization modules will be run in assemblies that prevent scanning. But it might be worth trying to call the synchronization from in such a module in each assembly..

If initialization module doesn't work, and you run CMS 12, then you could maybe create a IFirstRequestInitializer implementation that makes hardcoded calls to a class in each relevant assembly that then synchronizes the jobs. This sounds complicated, but may be the way, since the ServiceCollectionExtensions pattern will be invoked at an early stage.

#319697
Mar 29, 2024 16:26
Eric - Mar 29, 2024 16:34
For our epi jobs, we tried to keep them within each project that has that particular functionality. This way we can limit the db models, dbcontext and code. For now, I've added back scanning to just those projects that contain jobs and did some more consolidation. Before going to CMS 12 and asp core, we just lumped all the jobs in one large project. I'll look into seeing if I can initialize at a more granular level once we go live. We are a small shop so time is limited on what we can work on.
Stefan Holm Olsen - Mar 30, 2024 1:09
Sounds like a good solution in that case.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.