<workflow-app name="Retrieve Scholix Update" xmlns="uri:oozie:workflow:0.5">
    <parameters>
        <property>
            <name>sourcePath</name>
            <description>the source path of scholix graph</description>
        </property>
        <property>
            <name>datacitePath</name>
            <description>the datacite native path</description>
        </property>
        <property>
            <name>workingSupportPath</name>
            <description>the working Support path</description>
        </property>
        <property>
            <name>isLookupUrl</name>
            <description>The IS lookUp service endopoint</description>
        </property>
        <property>
            <name>updateDS</name>
            <value>false</value>
            <description>The transformation Rule to apply</description>
        </property>
    </parameters>

    <start to="RetrieveDeltaDatacite"/>

    <kill name="Kill">
        <message>Action failed, error message[${wf:errorMessage(wf:lastErrorNode())}]</message>
    </kill>

    <action name="RetrieveDeltaDatacite">
        <spark xmlns="uri:oozie:spark-action:0.2">
            <master>yarn</master>
            <mode>cluster</mode>
            <name>New Update from Datacite to Scholix</name>
            <class>eu.dnetlib.dhp.sx.graph.SparkRetrieveDataciteDelta</class>
            <jar>dhp-aggregation-${projectVersion}.jar</jar>
            <spark-opts>
                --executor-memory=${sparkExecutorMemory}
                --executor-cores=${sparkExecutorCores}
                --driver-memory=${sparkDriverMemory}
                --conf spark.extraListeners=${spark2ExtraListeners}
                --conf spark.sql.shuffle.partitions=6000
                --conf spark.sql.queryExecutionListeners=${spark2SqlQueryExecutionListeners}
                --conf spark.yarn.historyServer.address=${spark2YarnHistoryServerAddress}
                --conf spark.eventLog.dir=${nameNode}${spark2EventLogDir}
            </spark-opts>
            <arg>--sourcePath</arg><arg>${sourcePath}</arg>
            <arg>--datacitePath</arg><arg>${datacitePath}</arg>
            <arg>--master</arg><arg>yarn</arg>
            <arg>--workingSupportPath</arg><arg>${workingSupportPath}</arg>
            <arg>--isLookupUrl</arg><arg>${isLookupUrl}</arg>
            <arg>--updateDS</arg><arg>${updateDS}</arg>
        </spark>
        <ok to="End"/>
        <error to="Kill"/>
    </action>

    <end name="End"/>

</workflow-app>