This article summarizes and explains the different ways to execute Deliveries, except the deliveries deployed as webservices

 

 

scriptstartCommand[.bat/.sh]startDelivery[.bat/.sh]
Runtime modein memorystandalone
Remote launchRMI/HTTPNo
ClusteringYesNo
Launch modesSynchronous, AsynchronousSynchronous, Asynchronous
Outputreturn code,name,begin date,end date,configuration,session id,delivery id,runtime host,runtime port,execution mode,guest host,error message,exception,parent iteration,statusreturn code,begin date,end date,duration,statistics,session id,exception,status

 


From command line with the startdelivery script


The Runtime folder contains the startdelivery script (.bat and .sh). It can be used for executing Deliveries

Here is how it looks like in an interactive console (Windows "cmd" example): 


D:\apps\stambiaRuntime>startdelivery.bat -name "Extract Cities" -var "~/stateCode" "AZ" -sessionName "Extract Cities for AZ"

D:\apps\stambiaRuntime>echo off
##### BEGIN #####
02/02/2021 17:10:17,835 - Extract Cities for AZ (c0a84bba0177638245088c3b20543c3b) is started

-- DURATION = 00:00:00,741

##### STATISTICS #####

SQL_NB_ROWS=4
OUT_FILE_SIZE=58

02/02/2021 17:10:18,551 - Extract Cities for AZ (c0a84bba0177638245088c3b20543c3b) is ended
##### END #####
D:\apps\stambiaRuntime>echo %ERRORLEVEL%

0

Comments:

  • the -name parameter must reflect the name of the Delivery to execute - this Delivery must exist in the Runtime
  • -var is for specifying process parameters, here it is the state code
  • - sessionName can be handy for overriding the default session name
  • See the Reference Documentation for a full review of startdelivery's parameters


Note at the end of the console, we did an echo %ERRORLEVEL% (on Linux it would be "echo $?") to display the return code of the startdelivery command, which is 0 because there was no error. It would be -1 if there was an error in the Session. 


Important facts about startdelivery

  • startdelivery is starting a new Java process in the Operating System, it is not using the Runtime's Java process
  • startdelivery can execute a Delivery even when the Runtime is shutdown (when this Runtime is configured with an external log database)
  • starting many many startdelivery processes in parallel can be a cause of overloading the Runtime's server: make sure you don't launch or schedule too many jobs ni parallel, or the OS may end up with CPU or RAM saturation


From command line with the startcommand script

The startcommand script is a utility for connecting to a Runtime an executing commands into it. 

One of these commands is for executing Deliveries. 


Example: 


D:\apps\stambiaRuntime>startcommand.bat "connect to localhost port 42000;execute delivery \"Extract Cities\" var \"~/stateCode\" \"AZ\" synch"

D:\apps\stambiaRuntime>echo off
Connecting to localhost on port 42000
Connected
1

D:\apps\\stambiaRuntime>echo %ERRORLEVEL%
0

Comments:

  • startcommand takes only one argument: a semicolon-separated list of Runtime commands, being here "connect" and "execute delivery"
  • "connect" tells startcommand which Runtime it should talk to - it can be a remote Runtime, no need for the local Runtime to be started in this case
  • "execute delivery" takes the delivery name and parameters first, and the optional synch parameter at the end if we want startcommand to wait for the end of the session (otherwise the delivery is submitted in background and startcommand will stop instantly)
  • other options exist for "execute delivery", please consult the Reference Documentation for more details.

Important facts about startcommand + execute delivery:

  • the big difference with startdelivery is that the Delivery is executed in the Runtime's Java process
  • No java process created for the Delivery execution, and the Runtime has to be up and running 
  • Return code will reflect the session status (0=session in success, -1=error) only when the synch parameter is specified



Manually from the Designer : Right click / Execute


We are talking about the most common and handy way to execute directly from the Designer. 



When doing this, the following steps happen automatically:

  • The Designer makes a Build of the Delivery, as a result the "Extract Cities.deliv" file is stored in "build/deliveries" of the Designer's local Runtime - even when connected to a Remote Runtime
  • Then, the Designer connects to the Runtime and tells it to prepare and execute the Delivery.

The Delivery is executed in the Runtime's JVM, much like "startcommand" would do it. 



Manually from the Designer : Right click / Last Build / Execute



This method is pretty much the same as the standard Right click / Execute, except it will skip the first step and directly Prepare+Execute the delivery. 

Note: 

  • the Delivery must exist in the Designer's local Runtime
  • this method is useful (faster) when needing to execute the same Delivery again and again, without rebuilding it 


Manually from the Navigator (Analytics or Designer)


In this mode, the Delivery is executed in the Runtime's JVM, just like "startcommand" would do it.







Using the Scheduler

Note : The Scheduler is a licensed option, please make sure your company's license has acquired this option before using it. 


The Runtime embeds a "Quartz" Scheduler, which allows to schedule Deliveries with cron-like expressions. 


Schedules can be defined from the Navigator or from the Command line (see the Runtime Commands Reference for more information). 

From the Navigator, right click on a Delivery and choose New > Schedule.


Here is a sample Schedule definition: 


  • Name (optional): you can specify a name, or let the Schedule editor set it to a default name "CRON_<delivery>-<number>"
  • Job Name (optional): by default this is the Delivery Name. Important : all Schedules within the same "Job Name" will be queued, no matter which Delivery it executes. => Two deliveries with the same Job Name will not run at the same time.
  • Execution: this is where you choose to execute the Delivery in the Runtime's JVM (Memory => like startcommand) or in a separate JVM (Command Line => like startdelivery).
  • Session Name: you can specify the name of the executed sessions, by default this is the Delivery name.
  • Configuration: when a Delivery is Multi-Configuration, you can select the Configuration here
  • Cron Editor: this is where you can setup the times and days when the Delivery will be executed. In this example, it will start every day, every 2 hours between 4am and 6pm.


Invoking through the Runtime Soap/Rest endpoint

To be completed soon...

Note: this method is submitted to a license option.