0

How would it be possible to stop a specific running job in Kettle?

I'm using the following code:

KettleEnvironment.init();
JobMeta jobmeta = new JobMeta(C://Users//Admin//DBTOOL//EDW_Testing_Tool - 1.8(VersionUpgraded)//data-integration//Regress_bug//Start_Validation.kjb,
null);
Job job = new Job(null, jobmeta);
job.initializeVariablesFrom(null);
job.setVariable("Internal.Job.Filename.Directory", Constants.JOB_EXECUTION_KJB_FILE_PATH);
job.setVariable("jobId", jobId.toString());

job.getJobMeta().setInternalKettleVariables(job);
job.stopAll();

How would I ensure that the job which I want to stop is getting stopped and it is not executed after setting the flag?

I'm using rest api to stop the job and i'm not able to get the job Object. if i'm using CarteSingleton and store the object in map i'm not able to execute the job it gives driver error could not connect to database(eg:-jtds) url not working.

Ashish
  • 1
  • 2
  • I guess you run the job from another thread and maybe an other JVM. You should first put your finger on that job and issue `stopAll()` on that job, not on one just created even with the same name. – AlainD Nov 01 '17 at 14:56
  • Possible duplicate of [Stop running Kettle Job/Transformation using Java](https://stackoverflow.com/questions/33095298/stop-running-kettle-job-transformation-using-java) – tmarwen Nov 07 '17 at 11:52
  • you can set a db variable (like some field on some table on some db), and then check if that value is equal to some value (true/false, etc), you don't do the process in the kettle job (in the querys that you are executing), so, when the job is launched, check this "if", and if not... is not launched :) – Enrique San Martín Nov 07 '17 at 19:01

0 Answers0