Running Local Command Line Scripts
Deephaven provides a utility for running local "one-and-done" scripts via the command line. This function is accessible via iris_exec as follows:
/usr/illumon/latest/bin/iris_exec run_local_script [<launch args>] -- -s script.groovy [<options>] [<variable> <value>, …]
Options
The -s
option specifying the script file is required. There are other options as described below:
Option |
Req? |
Default |
Description |
---|---|---|---|
-s |
Yes |
N/A |
Script file to run |
-m |
No |
4 |
Worker heap size in GB |
-l |
No |
INFO |
Local log level - the log level to apply locally. Server messages are also affected; they will be logged locally with a |
-r |
No |
The same as that specified for Local (INFO if not specified). |
Remote log level - the log level to apply in the server when running the script. |
-t |
No |
Auto-detect from file extension |
Session/script type. Presently supported is "Groovy" or "Python". |
-o |
No |
N/A |
File to which script standard output should be directed. This output is also directed to the standard log, but this allows you to get a "clean" output from the script. |
-e |
No |
N/A |
File to which script standard error should be directed. This output is also directed to the standard log, but this allows you to get a "clean" output from the script. |
-sp |
No |
Initial script location |
Directory from which scripts should be sourced* |
-k |
No** |
|
Deephaven private key file |
-h |
No |
|
Query server host on which to run the script. |
-p |
No |
|
Query server port on which to run the script. |
* You can include common functionality in your groovy scripts with the source("stuff.groovy")
command. These scripts are sourced from the client file system relative to the initial script (or the location specified with the -sp
option, if present).
** Running a script on the Deephaven query server requires authentication which is provided by a private key file. You may set the path to this file in the environment variable "IRIS_KEYFILE
" or specify it on the command line with the -k
option. If present, the option overrides the environment variable.
Note: While this command executes a script located on the client file system, it is run on a Deephaven server, typically by the dbquery
or dbmerge
user, so resources on the client system are not typically available, with the exception of other scripts, via the source command.
This command also accepts positional arguments representing values that will be bound as global variables in the specified script. For example, the following will run the script fun.groovy
with the variable msg bound to the value "Hello World
" and pi
to 3.14159
(both as strings).
/usr/illumon/latest/bin/iris_exec run_script -- -s fun.groovy msg "Hello World" pi 3.14159
Logging
Under a typical configuration, iris_exec
outputs its log to a directory depending on which user executes it. By default, for the Deephaven system users (dbquery, dbmerge, irisadmin) or root, this is /db/TempFiles/<username>/logs
, and is /tmp/logs
for other users (since most users cannot write to Deephaven-owned directories). This can be customized by modifying the iris_exec
section of the illumon hostconfig (/etc/sysconfig/illumon
). Log messages are also copied to stdout so they can also be captured that way.
Last Updated: 23 September 2019 12:17 -04:00 UTC Deephaven v.1.20181212 (See other versions)
Deephaven Documentation Copyright 2016-2019 Deephaven Data Labs, LLC All Rights Reserved