Advanced Workflows with the Nitro API

Nitro includes an application programming interface (API) that allows users to create interactive clients (clients that submit tasks based on an external stimulus) or to create clients that can execute a complex workflow – all while using a single Moab job. If your workflow contains thousands of tasks, you’ll avoid the scheduling overhead of running the jobs separately under Moab, and you’ll keep control of your scheduled resource while running your set of tasks. I’ll use one example to show how Nitro can be used to create a workflow.

Meet Benjamin. He’s a pharmacology research engineer working on a new drug formulation that targets a specific heart-damaging bacteria. Ben is evaluating 400 different formulations of the drug, and has developed a molecular model (BacSim) that predicts the response of the bacteria to chemical interactions. But he needs to determine the best formulation, along with dosage and dose schedule. BacSim uses all of the processors on a single node and runs from 10 to 30 minutes depending on how quickly the bacteria responds to the drug formulation.

The first step in the process is to check each formulation with a baseline dosage, and if the bacteria responds by either a reduction or complete termination, then the formulation will move to the next stage of the process. In the second stage the dosage will be varied to find the minimum effective dosage. Then, in the third stage, the schedule of doses will be varied to determine the length of time at each dose schedule that the bacteria will be eradicated. BacSim takes an input file on the command line, performs its simulation with the formula as detailed in the input file, then writes an output file containing the details of the simulation cycle, an exit code of 0 if the simulation was successful (meaning the formulation reduced the bacteria) or 1 if the simulation detected that the formulation has no or negligible effect on the bacteria.

Here’s what the workflow looks like:

Nitro Workflow Example

First, we’ll need to launch Nitro in linger mode (there won’t be a task file to begin with, so linger mode tells Nitro to stick around ). We’ll also need to set the session key, and tell the nitro workers to only launch one task per node. Here is the script to launch the nitro job within Moab:

export NITRO_COORD_OPTIONS="--linger 60"
export NITRO_WORKER_OPTIONS="--thread-count 1"

You can then set a trigger on your Moab job to run the Nitro client when the job starts. The client will then connect to Nitro and start submitting tasks. For stage 1 tests, the client creates the task input file and submits a task to Nitro that looks like this:

name=Formula001Stage1 /opt/bacsim/bin/bacsim /opt/share/bacsim/inputs/formula001_stage1.dat

The client application submits the task to Nitro which then runs it on the first available worker. The client then generates similar task input files and task lines for the rest of the 400 formulations.

When one of the simulation programs exits, a message will be sent to the client with the results, including the simulation programs exit code, stdout, and stderr. From this output we can see if the formulation was successful and we can example the output file to see how many simulation iterations were required for the bacteria to be eradicated.

The client program doesn’t need to wait until all of the stage 1 simulations are finished – it can submit a stage 2 simulation as soon as it has determined that a successful formulation was found in stage 1. Then when a successful stage 2 simulation is performed, the client can submit the stage 3 task to Nitro.

Results are then gathered and a recommended set of formulations with the optimum dosages and dosing schedule can move forward to the next phase of development.

As you can see, Nitro isn’t just limited to launching billions of tasks at a high rate – it is also useful for interactive or client based workflow. Resources can be allocated to the job without incurring the scheduling overhead associated with thousands of jobs, and the process is completed much more efficiently.

If you have complex workflow problems and want to use your scheduler more efficiently, give us a call and we’ll show you how you can implement a Nitro API Client application to get your work done faster and more effectively.

Facebook Twitter Email

Speak Your Mind