Session Management

Get Sessions

This command returns the list of sessions from the log database configured for the runtime, as well as the sessions currently running in memory.

get sessions [name <name>]
    [id <id1,id2,idn>]
    [status <running,error,done,stopped>]
    [duration <min>]
    [to <max>]
    [limit <limit>]
    [format <format>]
Option Mandatory Description

name <name>

No

Session Name.

id <id1,id2,idn>

No

Comma-separated list of session IDs.

status <status>

No

Filter sessions with this status: running, error, done, stopped.

duration <min>

No

Filter sessions with this minimum duration in milliseconds.

to <max>

No

Filter sessions with this maximum duration in milliseconds.

limit <limit>

No

Number of sessions to retrieve.

format <format>

No

Comma-separated list of columns to return on the output. The available columns are %name, %status, %begindate, %enddate, %configuration, %id, %deliveryid, %runtimehost, %runtimeport, %executionmode, %guesthost, %errormessage, %exception, and %parentiter.

Stop a Session

This command sends a stop signal to a running session.

stop session <id> [synch] [format <format>]
Option Mandatory Description

id

Yes

ID of the session to stop.

synch

No

Waits for the session to be stopped to proceed. By default, the command does not wait until the session stops to proceed.

format

No

Comma-separated list of columns to return in the output. This option is supported only in synch mode. The following columns are available: %name,%status,%begindate,%enddate,%configuration,%id,%executionmode,%guesthost,%iter,%launchmode,%runtimehost,%runtimeport,%returncode,%errormessage,%exception,%parentiter

Example 1. Stop a session
stop session c0a84b0b016716c58c17de7b2e8a75c9

Sending a stop request to session c0a84b0b016716c58c17de7b2e8a75c9...
Stop request has been successfully sent to session c0a84b0b016716c58c17de7b2e8a75c9
Example 2. Stop a session with a formatted output
stop session c0a84b0b016716c6b50bd39807324430 synch format %id,%status,%returncode

Sending a stop request to session c0a84b0b016716c6b50bd39807324430...
Session: c0a84b0b016716c6b50bd39807324430 is stopping...
c0a84b0b016716c6b50bd39807324430,STOPPED,-2

Restart a Session

This command restarts a session.

restart session <id> [synch] [format <format>]
Option Mandatory Description

id

Yes

ID of the session to restart.

synch

No

Waits for the session to be restarted to proceed. By default, the command does not wait until the session restarts to proceed.

format

No

Comma-separated list of columns to return in the output. This option is supported only in synch mode. The following columns are available: '%name`, %status, %begindate, %enddate, %configuration, %id, %executionmode, %guesthost, %iter, %launchmode, %runtimehost, %runtimeport, %returncode, %errormessage, %exception, and %parentiter.

Example 3. Restart a session
restart session c0a84b0b016716c58c17de7b2e8a75c9

Session: c0a84b0b016716c58c17de7b2e8a75c9 is restarted
Example 4. Restart a session with a formatted output
restart session c0a84b0b016716c58c17de7b2e8a75c9 synch format %id,%status,%returncode

Session: c0a84b0b016716cadadf88fc29a8c399 is restarted...
c0a84b0b016716cadadf88fc29a8c399,ERROR,-1

Wait for a Session

This command waits for a session to complete, and issue the session return code as the output.

wait session <id> [format <format>]
Option Mandatory Description

id

Yes

Id of the session to wait for.

format

No

Comma-separated list of columns to return in the output when the session completes. The following columns are available: %name, %status, %begindate, %enddate, %configuration, %id, %executionmode, %guesthost, %iter, %launchmode, %runtimehost, %runtimeport, %returncode, %errormessage, %exception, and %parentiter.

Example 5. Wait for a session
wait session c0a84b0b016716cdb01b379e2eddf9a3

1
Example 6. Wait for a session with a formatted output
wait session c0a84b0b016716c58c17de7b2e8a75c9 format %id,%status,%returncode

c0a84b0b016716c58c17de7b2e8a75c9,EXECUTED,1

Purge Sessions

This command purges the session logs.

purge keep <number> <minute|hour|day|session>
    [sessionid <id1,id2,...>]
    [sessionname <name,name2,...>]
    [status <done,error,killed>]
Option Mandatory Description

keep <number> <minute|hour|day|session>

Yes

Number of sessions or historical duration to keep in the log.

sessionid <id>

No

Comma-separated list of sessions IDs to purge.

sessionname <name>

No

Comma-separated list of session names. Only sessions in this list are purged.

status <done,error,killed>

No

Comma-separated list of statuses. Purge sessions with these statuses.

Example 7. Keep only the last 100 sessions
purge keep 100 session
Example 8. Purge the session which ID is mySessionid
purge keep 0 session sessionid mySessionid
Example 9. Purge sessions named 'mySession' with the status 'done', keeping only the last 5
purge keep 5 session sessionname mySession status done
Example 10. Keep sessions for the last 3 days:
purge keep 3 day

Schedule a Purge

This command schedules a purge of sessions.

schedule purge keep <number> <minute|hour|day|session>
    cron <cron_expression>
    [sessionname <name,name2,...>]
    [sessionid <id1,id2,...>]
    [status <done,error,killed>]
    [on host <host_name>]
    [port <host_port>]
Option Mandatory Description

keep <number> <minute|hour|day|session>

Yes

Number of sessions or historical duration to keep in the log.

cron <cron_expression>

yes

Cron expression to run the schedule.

sessionid <id>

No

Comma-separated list of sessions IDs to purge.

sessionname <name>

No

Comma-separated list of session names. Only sessions in this list are purged.

status <done,error,killed>

No

Comma-separated list of statuses. Purge sessions with these statuses.

on host <host_name>

No

Hostname or address of the runtime host. If this option is not set, the currently connected runtime is used.

port <host_port>

No

Runtime port.

Example 11. Schedule a purge, keeping the 10 last sessions
schedule purge keep 10 session cron "0 15 10 * * ? *"