Rerun sucessful oozie jobs - scheduled-tasks

Is there a way to fully rerun successful oozie jobs. Let assume that we schedule creation a table and we want to rebuild it on demand - is there easy way to do it in oozie?
I try oozie -rerun command but if every action is successful it will not perform any results. It just checked that everything is successful and finish the job

Rerun with oozie.wf.rerun.failnodes set to false (it is true by default).
Example:
oozie job -rerun 0000092-141219003455004-oozie-oozi-W -config job.properties -Doozie.wf.rerun.failnodes=false
From Apache Oozie by Mohammad Kamrul Islam and Aravind Srinivasan
By default, workflow reruns start executing from the failed nodes in the prior run.... The property oozie.wf.rerun.failnodes can be set to false to tell Oozie that the entire workflow needs to be rerun.

If your job ran successfully and you want to rerun on demand you will have to find out the action number first by running this command: oozie job -info xxxxx-xxxxxxxx-xxx-C
and once you have the action number run this: oozie job -rerun xxxxxxx-xxxxxxxx-C -action xx
and you should be good then

Related

Set an output variable from an agentless job

I have a pipeline that runs an agentless job. This job produces a result that I would like to pass to the next or next job. The problem is that all the examples I've found set variables on agent jobs, not agentless. See here, all the examples use script commands, which need to be run on an agent.
Is there a way to set an output variable from an agentless job? How else can I pass the result from an agentless job to the next?
Setting output variables from agentless jobs isn't supported
powershell runs Windows PowerShell and will only work on a Windows agent.
https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/utility/powershell?view=azure-devops
Depending on what your use-case is, you may be able to use dependsOn and condition in your jobs to achieve your goal. E.g. for retries for builds that are not idempotent. Otherwise an agent-based configuration may be needed.

Create a Precheck job in jams powershell

I have set the jams workflow and jobs Retain Options = error.
I would like create a precheck job in jams powershell where I can cancel or block the instance of the job or workflow been started before the current workflow is finished.
So would anyone help me in creating a jams powershell inside the pscript or any other way.
I am new to this so I don't have a idea how to create it.

How to schedule the execution of a Python script in Azure DevOps (after successful Build)?

I have an Azure Pipeline Build. The *.yaml file executes correctly a Python script (PythonScript#0). This script itself creates (if does not exist), executes and publishes Azure ML pipeline. It runs well when the Build is executed manually or is triggered by commits.
But I want to schedule the automated execution of the ML pipeline (Python script) on a daily basis.
I tried the following approach:
pipeline_id = published_pipeline.id
recurrence = ScheduleRecurrence(frequency="Day", interval=1)
recurring_schedule = Schedule.create(ws,
name=<schedule_name>,
description="Title",
pipeline_id=pipeline_id,
experiment_name=<experiment_name>,
recurrence=recurrence)
In this case the pipeline runs during 3-4 seconds and terminates successfully. However, the Python script is not executed.
Also, I tried to schedule the execution of a pipeline using Build, but I assume that it is a wrong approach. It rebuilds a pipeline, but I need to execute a previously published pipeline.
schedules:
- cron: "0 0 * * *"
displayName: Daily build
always: true
How can I execute my published pipeline daily? Should I use Release (which agents, which tasks?)?
Also, I tried to schedule the execution of a pipeline using Build, but
I assume that it is a wrong approach. It rebuilds a pipeline, but I
need to execute a previously published pipeline.
Assuming your python-related task runs after many other tasks, then it's not recommended to simply schedule the whole build pipeline, it will rerun the pipeline(other tasks+python script).
Only the pipeline can be scheduled the instead of tasks, so I suggest you can create a new build pipeline to run the python script. Also, a private agent is more suitable for this scenario.
Now we get two pipelines: Original A and B which used to run the python script.
Set B's build completion to be A, so that if A builds successfully the first time, B will run after that.
Add a command-line task or PS task as pipeline A's last task. This task(modify the yml and then push the change) will be responsible for updating the B's corresponding xx.yml file to schedule B.
In this way, if A(other tasks) builds successfully, B(pipeline to run python script) will execute. And B will run daily after that successful build.
Hope it helps and if I misunderstand anything, feel free to correct me.

How to gracefully stop job execution when one step fails in Rundeck?

So I defined a Rundeck job which normally executes three steps:
run script to check remote directory for .csv files and rsync them
manipulate csv files
rsync the csvs back to remote dir
now I set up the script run on step 1 to finish with exit code 1 when there are no csv files in my remote directory, upon which it does not execute steps 2 and 3 - which is great! But the whole job is marked as having failed even though it just didn't need to execute the other steps.
Is it possible to conditionally execute steps 2 and 3 of my job such that if step 1 fails it is still marked as 'succeeded'?
It is possible with Rundeck Error Handlers.
You will need to use the job context variable ${result.resultCode} in your error handler code in order to get a return code.
As you don't want the job marked as failed after the Error Handler was successfully executed, you need to tick Keep going on success from WebUI or add keepgoingOnSuccess="true" to you job definition code.
But after the error handler was successfully executed, the job will continue step 2 and step 3, where you may need to inject your step 2 code for it.

How to prevent the crontab job execution, when it is already running

I want to schedule a job to run every 5 minutes. but the question is that
Is there a way (like creating a crontab) to prevent a job from running, when the previous job has not been completed?
You can write a shell script to start the job only when the job is not already running. Configure the shell script in crontab every 5 minutes. this will ensure that the execution happens only when there is no instance of the job running already. This is how i have done for my cron jobs
Note : make use of ps -ef | grep commands in your shell script to identify if there is a process already running