0
votes

I am wondered how oozie handle conflicts(if there really exists) when I submit two same workflow job(just the Oozie sample examples) at the same time. I can submit the same two job successful and oozie server return two different jobId.In Oozie Web Console, I saw status of two job are all RUNNING, then all SUCCEEDED after some time. My workflow.xml as followers:

<workflow-app xmlns="uri:oozie:workflow:0.2" name="map-reduce-wf">
    <start to="mr-node"/>
    <action name="mr-node">
        <map-reduce>
            <job-tracker>${jobTracker}</job-tracker>
            <name-node>${nameNode}</name-node>
            <prepare>
                <delete path="${nameNode}/user/${wf:user()}/mapreduce_test/output-data"/>
            </prepare>
            <configuration>
                <property>
                    <name>mapred.job.queue.name</name>
                    <value>default</value>
                </property>
                <property>
                    <name>mapred.mapper.class</name>
                    <value>org.apache.oozie.example.SampleMapper</value>
                </property>
                <property>
                    <name>mapred.reducer.class</name>
                    <value>org.apache.oozie.example.SampleReducer</value>
                </property>
                <property>
                    <name>mapred.map.tasks</name>
                    <value>1</value>
                </property>
                <property>
                    <name>mapred.input.dir</name>
                    <value>/user/${wf:user()}/mapreduce_test/input</value>
                </property>
                <property>
                    <name>mapred.output.dir</name>
                    <value>/user/${wf:user()}/mapreduce_test/output-data/</value>
                </property>
            </configuration>
        </map-reduce>
        <ok to="end"/>
        <error to="fail"/>
    </action>
    <kill name="fail">
        <message>Map/Reduce failed, error message[${wf:errorMessage(wf:lastErrorNode())}]</message>
    </kill>
    <end name="end"/>
</workflow-app>

I know in the "prepare" label delete output directory helps make the action repeatable and enables retries after failure, I also understand the basic action run model.

So, My questions are:

  1. The same two jobs are really running concurrently?(I saw the two all in running state in oozie web console).
  2. Is there exists write conflict?(two same job point one output directory)
2
You can run multiple workflows, doing different things, on different jobTrackers, and all labeled FooBar. Oozie does not care. - Samson Scharfrichter
But... if you use a Coordinator to run your Workflow, then you can define concurrency rules (e.g. only 1 at a time, FIFO). - Samson Scharfrichter

2 Answers

0
votes

Oozie does not detect any job duplication or anything like it. It accepts the workflow jobs and schedule them on the cluster for execution and monitor till the completion or failure.

The same two jobs are really running concurrently?(I saw the two all in running state in oozie web console).

Yes. Both the jobs will be running concurrently.

Is there exists write conflict?(two same job point one output directory)

Oozie does not have any checks related to write conflicts. I guess these are taken care by either map reduce or hdfs framework.

0
votes

As per your question: 1. Oozie schedule jobs on the cluster for execution till the end of end with status like success/failure. 2. Both Jobs will be running at same time and will execute same action what have been defined.

To Avoid the same you you can perform below steps which will bit helpfull.

As Oozie Jobs started with execution by triggering job.properties or coordinator.properties and starts the workflow to executing by as per mention interval passed through job.xml/coordinator.xml.

So when ever a request have been submitted it sill make a fresh entry in

COORD_JOBS for coordinator and WF_JOBS for workflow

tables in Metastore DB of Oozie {which could be "Oracle/MySQL/Postgress/Derby".

So even though the Job have been triggered the same can be start repeatedly as every time New ID have been set for respected Job. {As COORDINATOR JOB ID has been set as Incremental Basis}.

One way to avoid Duplicate Processing of the same Job, you can be done from Metastore DB end with some validation check.

Create a Trigger for COORD_JOBS table under Metastore DB, which will check the table entry with Job Name, query alike

  IF (SELECT COUNT(*) FROM COORD_JOBS WHERE (app_name = NEW.app_name) AND (status="RUNNING")) > 0 THEN
    SET NEW='Error: Cannot Update table.';
  END IF;

These DB Table trigger in COORD_JOBS/WF_JOBS tables will check every time when ever the Oozie tries to make update with new Job.

COORD_JOBS table can be replace with WF_JOBS table, which stores the Information of Workflow job details started by Coordinator.properties,