Stack
Run scripts later and in the background through the stack, a queue of executions with a process limit. Count, search, replay or delete the waiting, running, closed and failed executions, and follow flows with their steps and variables. Typical uses: process long tasks asynchronously, retry failed executions.
stackstack processstack statusstack resetstack process_limitstack count_waitstack count_runningstack count_closedstack count_errorstack flow_initstack flow_stepstack flow_json_getstack flow_json_setstack var_showstack delete_wait_idstack delete_wait_scriptstack delete_closed_idstack delete_closed_scriptstack delete_error_idstack delete_error_scriptstack reset_error_nbattempt_idstack reset_error_nbattempt_scriptstack replay_error_idstack replay_error_scriptstack getstack search

stack <exeDate> <scriptName> <varName1> <varlue1> <varNameN> <varlueN>


Description

    To execute a script through the stack

Parameters

    exeDate:   The execution date - string - required
    scriptName:   The script name - string - required
    varName1:   The variable name 1 - string - not required
    varlue1:   The value 1 - string - not required
    varNameN:   The variable name N - string - not required
    varlueN:   The value N - string - not required
admin
stack (date now) "division.post" "[v1]" 10 "[v2]" 5;
mentdb
2a
Used in use cases (19 recipes)

    Execution modes › Stack run postponed until a gate opens
    Async developer › Push a script to the stack and watch it close
    Scheduler developer › Postpone a stack run until a condition is true
    Event developer › The watcher validates, a heavy loader runs later in the stack
    Automation architect › Retry the failed runs of a worker
    Async developer › Plan reminders at J+7, J+15 and J+30, then cancel them
    and 13 more in the Use cases
Often used with

    date now  ·  script create  ·  script delete  ·  and  ·  wait  ·  while  ·  sequence add  ·  sequence get current

stack process


Description

    Process the stack

admin
stack process;
mentdb
1
Used in use cases (1 recipe)

    Automation architect › Retry the failed runs of a worker
Often used with

    date datedifft  ·  date now  ·  date sysdate  ·  job pause  ·  job resume  ·  stack  ·  stack count_error  ·  stack count_running

stack status


Description

    Get the status of the stack

admin
stack status;
mentdb
STACK STATUS PROCESS_LIMIT=10 lock=false lock_count=false STACK SCRIPT STACK PID
Used in use cases (2 recipes)

    Async developer › Dashboard of the stack queue
    Automation architect › Monitor the stack queue
Often used with

    stack count_closed  ·  stack count_error  ·  stack count_running  ·  stack count_wait  ·  stack process_limit  ·  string regexp_extract  ·  string substring  ·  date dateadd

stack reset


Description

    Reset the locks of the stack

admin
stack reset;
mentdb
1
Used in use cases (1 recipe)

    System administrator & DevOps › Maintenance window: lock, change the config, reopen
Often used with

    and  ·  config reload  ·  config set  ·  job scheduler restart  ·  kill  ·  log remove  ·  log trace  ·  log write

stack process_limit


Description

    Show the process limit of the stack.

admin
stack process_limit;
mentdb
4
Used in use cases (2 recipes)

    Async developer › Dashboard of the stack queue
    Automation architect › Monitor the stack queue
Often used with

    stack count_closed  ·  stack count_error  ·  stack count_running  ·  stack count_wait  ·  stack status  ·  string regexp_extract  ·  string substring  ·  date dateadd

stack count_wait


Description

    Count all waiting executions in the stack.

admin
stack count_wait;
mentdb
2
Used in use cases (5 recipes)

    Backend & web service developer › Health check endpoint for the load balancer
    Async developer › Plan reminders at J+7, J+15 and J+30, then cancel them
    Automation architect › Monitor the stack queue
    Async developer › Dashboard of the stack queue
    Automation architect › Retry the failed runs of a worker
Often used with

    stack count_error  ·  string substring  ·  date now  ·  script create  ·  script delete  ·  stack  ·  stack count_running  ·  stack delete_wait_script

stack count_running


Description

    Count all running executions in the stack.

admin
stack count_running;
mentdb
4
Used in use cases (3 recipes)

    Async developer › Dashboard of the stack queue
    Automation architect › Monitor the stack queue
    Automation architect › Retry the failed runs of a worker
Often used with

    stack count_error  ·  stack count_wait  ·  string substring  ·  date sysdate  ·  stack  ·  stack count_closed  ·  stack delete_wait_script  ·  stack process_limit

stack count_closed


Description

    Count all closed executions in the stack.

admin
stack count_closed;
mentdb
406
Used in use cases (2 recipes)

    Async developer › Dashboard of the stack queue
    Automation architect › Monitor the stack queue
Often used with

    stack count_error  ·  stack count_running  ·  stack count_wait  ·  stack process_limit  ·  stack status  ·  string regexp_extract  ·  string substring  ·  date dateadd

stack count_error


Description

    Count all executions in error in the stack.

admin
stack count_error;
mentdb
122
Used in use cases (5 recipes)

    Backend & web service developer › Health check endpoint for the load balancer
    Async developer › Replay a whole batch of failed exports
    Automation architect › Monitor the stack queue
    Async developer › Dashboard of the stack queue
    Automation architect › Retry the failed runs of a worker
Often used with

    stack count_wait  ·  string substring  ·  date now  ·  script create  ·  script delete  ·  stack  ·  stack count_running  ·  stack search

stack flow_init <pid> <nameFlow> <json>


Description

    Initialize the name of a flow process

Parameters

    pid:   The pid of the flow - string - required
    nameFlow:   The name of the flow - string - required
    json:   The JSON object to save - string - required
admin
stack flow_init [PID] "name_of_the_flow" "{}";
mentdb
1
Used in use cases (2 recipes)

    Async developer › Track the steps of a long import with a stack flow
    Automation architect › Nightly import with a cron, a file watcher and a flow
Often used with

    json doc  ·  json iobject  ·  script create  ·  stack flow_json_get  ·  stack flow_json_set  ·  stack flow_step  ·  and  ·  date now

stack flow_step <pid> <position> <posName>


Description

    Mark a new step for the specified flow

Parameters

    pid:   The pid of the flow - string - required
    position:   The step position - number - required
    posName:   The position name - string - required
admin
stack flow_step [PID] 1 "Begin_of_the_flow";
mentdb
1
Used in use cases (2 recipes)

    Async developer › Track the steps of a long import with a stack flow
    Automation architect › Nightly import with a cron, a file watcher and a flow
Often used with

    json doc  ·  json iobject  ·  script create  ·  stack flow_init  ·  stack flow_json_get  ·  stack flow_json_set  ·  and  ·  date now

stack flow_json_get <pid>


Description

    Put a key/value pair into a specified flow (stack process)

Parameters

    pid:   The pid of the flow - string - required
admin
json load "flow_json" (stack flow_json_get [PID]);
mentdb
1
Used in use cases (2 recipes)

    Async developer › Track the steps of a long import with a stack flow
    Automation architect › Nightly import with a cron, a file watcher and a flow
Often used with

    json doc  ·  json iobject  ·  script create  ·  stack flow_init  ·  stack flow_json_set  ·  stack flow_step  ·  and  ·  date now

stack flow_json_set <pid> <json>


Description

    Put a key/value pair into a specified flow (stack process)

Parameters

    pid:   The pid of the flow - string - required
    json:   The JSON object to save - string - required
admin
stack flow_json_set [PID] (json doc "flow_json");
mentdb
1
Used in use cases (2 recipes)

    Async developer › Track the steps of a long import with a stack flow
    Automation architect › Nightly import with a cron, a file watcher and a flow
Often used with

    json doc  ·  json iobject  ·  script create  ·  stack flow_init  ·  stack flow_json_get  ·  stack flow_step  ·  and  ·  date now

stack var_show <pid>


Description

    Get variables for a specific process

Parameters

    pid:   The pid of the process - string - required
admin
stack var_show 1;
mentdb
[]
Used in use cases (3 recipes)

    Async developer › Plan reminders at J+7, J+15 and J+30, then cancel them
    Event developer › The watcher validates, a heavy loader runs later in the stack
    Automation architect › Retry the failed runs of a worker
Often used with

    date now  ·  stack  ·  stack delete_wait_script  ·  stack search  ·  string substring  ·  date dateaddt  ·  script create  ·  script delete

stack delete_wait_id <pid>


Description

    Delete a specific execution (wait).

Parameters

    pid:   The process id - number - required
admin
stack delete_wait_id 4;
mentdb
1
Used in use cases (1 recipe)

    Async developer › Plan reminders at J+7, J+15 and J+30, then cancel them
Often used with

    date dateaddt  ·  date now  ·  log write  ·  script create  ·  script delete  ·  script generate stack  ·  stack  ·  stack count_wait

stack delete_wait_script <scriptName>


Description

    Delete all executions for a specific script (wait).

Parameters

    scriptName:   The script name - string - required
admin
stack delete_wait_script "division.post";
mentdb
25
Used in use cases (13 recipes)

    Async developer › Plan reminders at J+7, J+15 and J+30, then cancel them
    Event developer › Run a script when a file arrives in a folder
    Automation architect › Retry the failed runs of a worker
    Async developer › Priorities and parallel limit of the stack
    Async developer › Dashboard of the stack queue
    Async developer › A dispatcher pushes child runs and you follow the whole tree
    and 7 more in the Use cases
Often used with

    script create  ·  script delete  ·  stack delete_closed_script  ·  string substring  ·  and  ·  date now  ·  wait  ·  while

stack delete_closed_id <pid>


Description

    Delete a specific execution (closed).

Parameters

    pid:   The process id - number - required
admin
stack delete_closed_id 4;
mentdb
1
Used in use cases (7 recipes)

    Async developer › Push a script to the stack and watch it close
    Scheduler developer › Postpone a stack run until a condition is true
    Automation architect › Kill a runaway process of the stack
    Async developer › A run fails, the API comes back, replay it
    Async developer › Track the steps of a long import with a stack flow
    Async developer › Same script: execute now or hand it to the stack
    and 1 more in the Use cases
Often used with

    and  ·  date now  ·  script create  ·  script delete  ·  stack  ·  wait  ·  while  ·  sequence add

stack delete_closed_script <scriptName>


Description

    Delete all executions for a specific script (closed).

Parameters

    scriptName:   The script name - string - required
admin
stack delete_closed_script "division.post";
mentdb
25
Used in use cases (15 recipes)

    Execution modes › Stack run postponed until a gate opens
    Async developer › Priorities and parallel limit of the stack
    Scheduler developer › A job that only queues work in the stack
    Event developer › Run a script when a file arrives in a folder
    Automation architect › Retry the failed runs of a worker
    Async developer › Replay a whole batch of failed exports
    and 9 more in the Use cases
Often used with

    and  ·  script create  ·  script delete  ·  wait  ·  while  ·  date now  ·  stack delete_wait_script  ·  string substring

stack delete_error_id <pid>


Description

    Delete a specific execution (error).

Parameters

    pid:   The process id - number - required
admin
stack delete_error_id 4;
mentdb
1
Used in use cases (3 recipes)

    Async developer › Replay a whole batch of failed exports
    Automation architect › Retry the failed runs of a worker
    Automation architect › Kill a runaway process of the stack
Often used with

    date now  ·  stack  ·  and  ·  script create  ·  script delete  ·  sequence add  ·  sequence get current  ·  sequence increment

stack delete_error_script <scriptName>


Description

    Delete all executions for a specific script (error).

Parameters

    scriptName:   The script name - string - required
admin
stack delete_error_script "division.post";
mentdb
10
Used in use cases (2 recipes)

    Async developer › Clean the stack after a test campaign
    Event developer › A bad file ends in the error table of the stack
Often used with

    and  ·  atom get  ·  date dateaddt  ·  date now  ·  exception  ·  script create  ·  script delete  ·  script set stack

stack reset_error_nbattempt_id <pid>


Description

    Reset the number of attempts (error).

Parameters

    pid:   The process id - number - required
admin
stack reset_error_nbattempt_id 4;
mentdb
1
Used in use cases (3 recipes)

    Async developer › A run fails, the API comes back, replay it
    Automation architect › Retry the failed runs of a worker
    Automation architect › Replay a failed run once the partner is back
Often used with

    date now  ·  stack  ·  stack get  ·  stack replay_error_id  ·  and  ·  exception  ·  script create  ·  script delete

stack reset_error_nbattempt_script <scriptName>


Description

    Reset the number of attempts (error).

Parameters

    scriptName:   The script name - string - required
admin
stack reset_error_nbattempt_script "division.post";
mentdb
1
Used in use cases (2 recipes)

    Async developer › Replay a whole batch of failed exports
    Automation architect › Retry the failed runs of a worker
Often used with

    date now  ·  stack  ·  stack count_error  ·  stack delete_closed_script  ·  stack delete_error_id  ·  stack replay_error_script  ·  stack search  ·  string substring

stack replay_error_id <pid>


Description

    Replay a specific execution (error).

Parameters

    pid:   The process id - number - required
admin
stack replay_error_id 4;
mentdb
1
Used in use cases (3 recipes)

    Async developer › A run fails, the API comes back, replay it
    Automation architect › Retry the failed runs of a worker
    Automation architect › Replay a failed run once the partner is back
Often used with

    date now  ·  stack  ·  stack get  ·  stack reset_error_nbattempt_id  ·  and  ·  exception  ·  script create  ·  script delete

stack replay_error_script <scriptName>


Description

    Replay all executions for a specific script (error).

Parameters

    scriptName:   The script name - string - required
admin
stack replay_error_script "division.post";
mentdb
7
Used in use cases (2 recipes)

    Async developer › Replay a whole batch of failed exports
    Automation architect › Retry the failed runs of a worker
Often used with

    date now  ·  stack  ·  stack count_error  ·  stack delete_closed_script  ·  stack delete_error_id  ·  stack reset_error_nbattempt_script  ·  stack search  ·  string substring

stack get <pid>


Description

    To show a specific execution (with variables).

Parameters

    pid:   The process id - number - required
admin
stack get 4;
mentdb
{ "lastattempt": "2018-01-04 10:39:17.0", "dtcreate": "2018-01-04 10:32:07.0", "nbattempt": "1", "dtclosed": null, "dtexe": "2018-01-04 10:32:07.0", "pid": "17", "login": "admin", "script": "addition.post", "dterror": "2018-01-04 10:39:17.0", "nbmaxattempt": "1", "lasterrormsg": "\nline 1 \u003e\u003e\u003e addition.post [v1] 12 [v2] 19 \nline 2 \u003e\u003e\u003e exception 1; \"\\\"your message ...\\\";\" ; 1: your message ..." }
Used in use cases (12 recipes)

    Execution modes › Stack run postponed until a gate opens
    Async developer › Push a script to the stack and watch it close
    Scheduler developer › Postpone a stack run until a condition is true
    Event developer › The watcher validates, a heavy loader runs later in the stack
    Automation architect › Retry the failed runs of a worker
    Async developer › Priorities and parallel limit of the stack
    and 6 more in the Use cases
Often used with

    date now  ·  and  ·  script create  ·  script delete  ·  stack  ·  wait  ·  while  ·  sequence add