question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cancel job whose object the script does not have access to

See original GitHub issue

Let’s say I ran this script to schedule a job:

var j = schedule.scheduleJob({hour: 14, minute: 30, dayOfWeek: 0}, function(){
  console.log('Time for tea!');
});

Now, I write a new script to cancel the job above, which doesn’t have access to the j that I created above, so I can’t just j.cancel(). Is there a way that I can cancel the job above?

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:1
  • Comments:6

github_iconTop GitHub Comments

9reactions
peterdaniscommented, Jan 24, 2021

You can access all registered jobs via scheduledJobs object. In my case I use an id as name passed as first parameter to scheduleJob function.

2reactions
Huy-Ngocommented, Aug 31, 2020

I was thinking about some solution like having j.id saved somewhere then get it back by calling j = schedule.getById('job id here') but I don’t know if it’s an available feature.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Job Objects - Win32 apps - Microsoft Learn
To terminate all processes currently associated with a job object, use the TerminateJobObject function. Job Limits and Notifications. A job can ...
Read more >
Using Job Runner - CygNet Help
It uses a separate script engine and therefore does not have access to the shared ... The first step in executing a Job...
Read more >
Jobs - AWS Glue
This section describes the AWS Glue API related to Jobs. ... You can specify arguments here that your own job-execution script consumes, ...
Read more >
Handling the 'Object Does Not Exist' Error - SmartBear Support
Examine your application and check whether the desired object exists. For instance, developers could change the tested application and remove the tested form...
Read more >
Creating, Running, and Managing Jobs
A credential is a user name and password pair stored in a dedicated database object. You assign a credential to a job so...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found