4 Replies Latest reply on Sep 12, 2016 11:52 AM by cfang

    Job Run tables and 3rd party Scheduler

    richardmoore

      I need to be able to trigger a restart of a failed job in whatever step the developer needs run. I wanted to process our scheduler request for a restart and set the job_execution or other table(s) so that when the operator.restart(id, parms) statement is executed processing will pick up in the requested step. What update(s) do I need to make to do this?

        • 1. Re: Job Run tables and 3rd party Scheduler
          cfang

          For a restart after a failed job execution, JBeret automatically restarts from the previous failed job element.  However, step has an attribute "allow-start-if-complete", if set to true, the restart after a failed execution will still run these completed steps, even though they appear before the failed step in job.xml.  This may be something you want to leverage.

           

          For a restart after a stopped job execution, user can set the restart position in job.xml.

           

          The restart position is stored in JOB_EXECUTION table as column RESTARTPOSITION, in the job repository db.  I don't think you should need to change the job execution data in job repository.

           

          If you want to dynamically set the restart position for a restart after a failed job execution, you can try some JBeret internal api (not stable and not recommented) to modify the internal restartPosition value.

           

          If you know where to restart when a step fails, use a job listener, whose afterJob method calls org.jberet.runtime.JobExecutionImpl#setRestartPosition

           

          If you know where to restart at restart time, use a job listener, whose beforeJob method calls

          org.jberet.runtime.JobExecutionImpl#setRestartPosition.  The desired restartPosition may be passed in as restart job param.

           

          You can access JobExecutionImpl by injecting JobContext, cast it to JobContextImpl, and jobContextImpl.getJobExecution().

          • 2. Re: Job Run tables and 3rd party Scheduler
            richardmoore

            I really appreciate the help you and James have given me in implementing JBeret.

            • 3. Re: Job Run tables and 3rd party Scheduler
              cfang

              you're welcome.  It could be a useful feature in JBeret to support custom restart position in a portable way without relying on JBeret internal methods.

              • 4. Re: Job Run tables and 3rd party Scheduler
                cfang

                JBERET-256

                Support custom restart step/position

                 

                this issue has been fixed and included in JBeret 1.3.0.Beta3 release.