Hi,
The EPiServer.BaseLibrary.Scheduling.JobBase and EPiServer.Scheduler.ScheduledJobBase should be used as base class.
The OnStatusChanged method, should work using:
this.OnStatusChanged("Job step");
This is the code for my job;
[ScheduledPlugIn( Description = "Index all members", DisplayName = "EPiServer Find Members indexing job", SortIndex = 9900)] public class MemberIndexer : EPiServer.BaseLibrary.Scheduling.JobBase
OnStatusChanges does not update the UI.
I'm not sure what you mean by EPiServer.BaseLibrary.Scheduling.JobBase and EPiServer.Scheduler.ScheduledJobBase...
I tested it on Alloy. And it looks like it's working. Try to add this test job to your code and check if it's working:
using System.Threading; using EPiServer.PlugIn; namespace ExtendingCompareVersion.Business { [ScheduledPlugIn(DisplayName = "Test Job")] public class TestJob: EPiServer.Scheduler.ScheduledJobBase { public override string Execute() { for (var i = 0; i < 10; i++) { this.OnStatusChanged("Job in progress: " + i); Thread.Sleep(1500); } return "Job completed"; } } }
Looks like the ScheduledJobBase is a CMS 9 Class. I'm still on 8.11.
My code did work before, not sure if it happened in 8.11 or one of the minor releases before that.
Trond, Grzegorz,
I'm having this issue on Epi 10.4.2.0 . I even tried Grzegorz's simple Test Job with Thread.Sleep example for sanity's sake, and it's still not publishing any statuses whatsoever for me. Have either of you run into this again since, or found any solutions?
P.S. I'd love to paste a screenshot, but can't for the life of me find how to attach a dang image in this wysiwyg.
Maxim, if you open "Network" tab in devtools - is page refresh happening to fetch new running status?
@Valdis -- yep, sure does. It tries to hit /EPiServer/CMS/Admin/DatabaseJob.aspx?GetRunningState=0838b94b-5e54-494f-9416-e611afe9e201 for the URL, and fails due to a null reference, it seems.
Going to attempt pasting the stack trace below.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ArgumentNullException: Value cannot be null.
Parameter name: String
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. |
Stack Trace:
[ArgumentNullException: Value cannot be null. Parameter name: String] System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal) +14289492 System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info) +177 ScheduledParameterJob.DatabaseJobAdapter.get_Attribute() +48 ScheduledParameterJob.DatabaseJobAdapter.OnInit(EventArgs e) +30 System.Web.UI.Control.InitRecursive(Control namingContainer) +11938992 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +464 |
Hmm, having a look -- but that shouldn't be required to provide basic status updates, should it? I thought that was default functionality for scheduled jobs.
No, that's separate package to be able to parametrize job runs (pass in parameters for jobs on every execute cycle). It's not standard Episerver stuff.
I see. Well, regardless, it looks like I already do have it :(
Package 'ScheduledParameterJob.1.1.0' already exists in project 'xxxx'
Any other ideas? :)
Question remains open - do you need that package? If not - try to uninstall and see if that solves the issue.
Gotcha -- I misunderstood, I thought you were saying I was missing it.
Genius. Removing that fixed all the things, it seems. Very interesting. The buttons for "Show Statistics" and "Scheduled job overview" even appeared, which were missing before. I guess that thing breaks a whole ton of stuff.
Thank you very much Valdis!
Hah -- I think you probably noticed that I had no idea what that was! So I definitely wasn't the one to install it, and will now know to avoid it like the plague :)
No I mean for "show statistics" and "overview" buttons.. I've seen those somewhere ;)
Ohhhh. God yeah, you're right, I think I saw those as a part of some plugin somewhere too. Hahaha, sheesh!
Hi,
Our servers are running EPiServer v8.11.
We have encountered a problem with jobs inherited from EPiServer.BaseLibrary.Scheduling.JobBase.
The admin UI will no longer show the update messages provided by the OnStatusChanged method. This makes it hard to see if a task is still running or started at all when starting them manually. I have searched all over, but have not seen any other report this problem.
Have anybody come across this problem before?
regards,
Trond Nilsen