Sign In Register

How can we help you today?

Start a new topic

Cannot schedule bulk job from system scheduler?

Tried calling Spark.getBulkScheduler().submitJobModule() from inside one of the system scrips (everyHour, everyMinute) and received this error:

"You cannot schedule a bulk job from this script"


Is that expected?  I had only placed it in everyMinute to test the logic  - the goal was to place it in everyHour - but even then, it was conditional - would only schedule a bulk job on a certain hour of the day.


Thoughts?

Workarounds?


1 person has this question

Hi Jeff,


Yes this is the expected behavior here. You can't schedule jobs within the system scheduled scripts. Its to protect from jobs piling up and causing a heavy load on the clusters. What are you trying to schedule in the every hour script ? If you can give us an idea of what you need here we can point you in the right direction I'm sure.


Regards,

Liam

Again - I was simply using the everHour script to execute a bulk job that I needed to actually run every couple of weeks - but at a specific dynamically determined time (related to seasonal tournament notifications to players).


Note that I WAS able to make this work by creating a new SparkRequests.ScheduleBulkJobAdminRequest() and calling Send() on it.... (inside the everyHour script). 

Hi Jeff,


We're going to try to replicate this. We'll get back to you soon.


Thanks,

Liam

Hi Jeff,


I managed to replicate this and you are right. It would appear that it can be sent using a SparkRequest. I'm awaiting confirmation but for now I would hold off using this as it may have its usage removed from those scripts. For now you could use the Every Day script and check what day it is. If it's the correct day you can schedule a module to run at a specific time that day.

 

//get the day
var day = new Date().getDate();

if (day == 20){
//schedule your module to run
}


If you have any further questions just let us know.  


Thanks,

Liam

The issue is not with the timing (although I still need to use every-hour - because the season-end can be at any hour/day depending on a very dynamic setup) - but instead with being able to kick off a bulk-job request THROUGH the system EveryXXX scripts.  

Hi Jeff,


Using the ScheduleBulkJobAdminRequest in this way would not be recommended here. BulkJobs were never intended to be used from these system scripts. Using the Scheduled module method outlined above would likely be the best course of action here. Is there a reason why you feel a bulkJob is the best way to achieve what you need here ?


Thanks,

Liam

I need to kick off a bulk job (that does exactly what a bulk job is designed to do - iterate over large swaths of players and execute cloud code...logic that could take over the normal cloud code execution time limit en totem) - but I need to do it NOT by manually kicking off the bulk job - but dynamically when the calendar/clock hit certain milestones (dynamically determined).

Hi Jeff,


I understand where you're coming from here but the ScheduleBulkJobAdminRequest wouldn't be the right way to go about this. I think if we had more details about exactly what would be executed and who it would be executed on we could help point you in the right direction here. We can convert this to a ticket if you'd prefer to discuss it privately ?


Thanks,

Liam

Just came across this thread as I needed exactly the same functionality as Jeff.

I have leaderboards and events in the game which are not just WEEKLY or MONTHLY or DAILY. I need reset them is times defined by me and automatically. Therefore I cannot give rewards to players in these leaderboards by using Achievements Triggers. So I tried to give rewards to these players by using bulk jobs in system time scrips . Specifically I am using "Every_Hour" script, where I check if it is the right day and hour of the day and If it is,  I call the bulk job to give players reward. And it works. 

Therefore I want to ask here, whether it is a correct way of doing these kind of things as I could not find any other solution and I also do not want to do "some bad things" to the service.

Login to post a comment