celos.importDefaults("example-settings");

function inputPathForDataCenter(dc) {
    return "/user/" + CELOS_USER + "/celos/quickstart/input/" + dc + "/${year}-${month}-${day}/${hour}00";
}

function outputPathForDataCenter(dc) {
    return "/user/" + CELOS_USER + "/celos/quickstart/output/" + dc + "/${year}-${month}-${day}/${hour}00";
}

function defineWordCountWorkflow(dc) {
    var inputPath = inputPathForDataCenter(dc);
    var outputPath = outputPathForDataCenter(dc);
    celos.defineWorkflow({
        "id": "wordcount-" + dc,
        "schedule": celos.hourlySchedule(),
        "schedulingStrategy": celos.serialSchedulingStrategy(),
        "trigger": celos.hdfsCheckTrigger(inputPath + "/_READY"),
        "externalService": celos.oozieExternalService({
            "oozie.wf.application.path": "/user/" + CELOS_USER + "/celos/quickstart/app/workflow.xml",
            "inputPath": inputPath,
            "outputPath": outputPath
        })
    });
}

defineWordCountWorkflow("nyc");
defineWordCountWorkflow("lax");

@@ -36,16 +36,73 @@
 ngs%22);%0A%0A
+var ROOT = %22/user/%22 + CELOS_USER + %22/celos/quickstart%22;%0A%0A
 function
@@ -146,50 +146,16 @@
 urn 
-%22/user/%22 + CELOS_USER + %22/celos/quickstart
+ROOT + %22
 /inp
@@ -261,50 +261,16 @@
 urn 
-%22/user/%22 + CELOS_USER + %22/celos/quickstart
+ROOT + %22
 /out
@@ -795,50 +795,16 @@
 h%22: 
-%22/user/%22 + CELOS_USER + %22/celos/quickstart
+ROOT + %22
 /app
@@ -943,11 +943,11 @@
 ow(%22
-nyc
+lax
 %22);%0A
@@ -955,31 +955,32 @@
 efineWordCountWorkflow(%22
-lax
+nyc
 %22);%0A
+%0A

Refactor workflow.js