Jobs-as-Code

“Jobs-as-Code” denotes a capability of maintaining application workflows, workloads, and jobs as software artifacts that can be managed using existing version control and deployment toolchains. Today most workload automation tools maintain their definitions and executions in proprietary tools and formats that are not amenable to standard development and deployment practice. Some examples of common workflows include file transfers and validation, report generation and distribution, and ETL data collection and execution.

Flux has supported Jobs-As-Code since its inception in 2000. Being 100% Java, Flux integrates into a development organization’s version control and deployment toolchains. This facilitates the development, testing, and deployment of applications and systems requiring support for complex workflows and workload automation. Using Flux’s Java API and REST API developers can include the rules and workflows used to schedule and direct their batch applications such as payment processing, bill of lading and manifest preparation, and customer billing. These Jobs-as-Code workflows define the timing, sequence, error and exception handling, and distribution of work across your computing resources.

What is a Flux “Job-as-Code”?

The following sample Java code shows the creation of a Flux engine, the timed execution of a simple flowchart to bring up Windows Notepad at 12:35 pm, and a message announcing the flowchart has finished. In Flux parlance, a “job” is a Flux workflow.

public class RunAProcess {

public RunAProcess () throws Exception {
Engine flux = Factory.makeInstance().makeEngine();
FlowChart job = EngineHelper.makeFlowChart("/Native Process Job");
TimerTrigger timerTrigger= job.makeTimerTrigger("Start at 12:35");
timerTrigger.setTimeExpression("0 0 35 12");
ProcessAction processAction = job.makeProcessAction("Run Notepad");
processAction.setCommand("notepad.exe");  // Set the command to execute
ConsoleAction consoleAction = job.makeConsoleAction("Announce Completion");
ConsoleAction.setMessage("Finished");
timerTrigger.addFlow(processAction);  // Flow from the timer to the process
processAction.addFlow(consoleAction);  // Flow from the process to the console action
flux.put(job);  // Add the job to the engine for execution.
flux.start();  // Start the Flux engine to run this job, and any other jobs added to the Flux engine
Thread.sleep(5000);  // Give the engine a chance to run the job and execute the named process, shell or batch script
flux.dispose();    // Release resources.
} // constructor

/**
* A simple way to run this example.
  */
  public static void main(String[] args) throws Exception {
  new RunAProcess ();
  } // main()

} // class RunAProcess 

The above code illustrates a simple sequential workflow. Through the Flux API one can create sophisticated workflows that initiate parallel flows, split and join on tasks, wait on events, and distribute work to remote agents or network nodes (via SSH commands) for processing.

Flux can be embedded into applications as a Java jar file or run standalone to provide sophisticated workflow and workload automated facilities to software development staff while facilitating development’s delivery of a hardened and production-ready application to the Operations staff.