This HTML automatically generated with rman for NEMO
Table of Contents

Name

nemovar - get and set NEMOVAR variables

Synopsis

nemovar [parameter=value]

Description

nemovar maintains a NEMO key/value storage server. It will providing another method to communicate (textual) information between tasks using key/value pairs. These are persistent variables, and can cross different sessions, much like SHELL variables.

The current implementation uses a simple text file, but future implementation may also be able to switch to shared memory, or whatever the operating system and environment provides, or what the users’ workflow prefers.

Parameters

The following parameters are recognized in order; they may be given in any order if the keyword is also given. Use --help to confirm this man page is up to date.
var=
Name of the variable. Default: not used.
val=
If used, the variable is getting a new value. Default: not used.
**delete=f|t
Delete the named variable in var=.
**load=
Load from a file. Need a replace/merge option?
**save=
Save to a file.

Examples

The NEMOVAR environment variable is used to set the interprocess communication (currently only files are supported). For example on linux we might be able to use the shared memory as follows:

export NEMOVAR=/dev/shm/nemovar.$USER
nemovar a 10

to set the value of 10 to a. Then

nemovar a

retrieves the value of a. And finally

nemovar

just shows all variables. Output is always to stdout.

Format

Currently the format of the text file is a simple ASCII file, where all named variables are explictly shown as strings:

a="10"
b="hello world"
c="3.141592"

to make it compatible with possible future bash(1) and python(1) clients. The data type interpretation is left to the client. This also opens the option for small lists, e.g.

d="1,2,10:20:2"

Background

There are several ways already to pass small textual information (outside of the large simulations files) between NEMO programs, usually aided by the shell.

First of all, shell variables can be an effective way to control a script, but sometimes they need to be extracted from a program, e.g. with some awk/grep/sed, or in this example with txtpar(1NEMO) ccdstat foo.ccd > foo.log
mean=$(txtpar foo.log p0=Mean,1,5)
disp=$(txtpar foo.log p0=Mean,1,6)
ccdplot foo.ccd $mean-$disp,$mean,$mean+$disp
here we extracted the mean and dispersion from a map, and plotted contours of the mean, and one dispersion around the mean. Assuming these variables from the previous example happen to be in a file called nemopars.rc, the following will work mean=$(nemopars mean)
disp=$(nemopars disp)

Simulations can store results in a keyword=value textual database, something that can be easily read by the shell, or python, or nemopars(1NEMO) .

With the first version of nemovar you can do the following: export NEMOVAR=nemopars.rc
mean=$(nemovar mean)
disp=$(nemovar disp)

The power of nemovar will come when the user interface shortcuts the use of the shell,as in this hypothetical example ccdstat foo.ccd nemovar=mean,disp
ccdplot foo.ccd %mean-%disp,%mean,%mean+%disp’

Future

1. A future implementation will allow direct retrieval of NEMO variables is possible via the command line (see getparam(3NEMO) ). For example, compare the two style, nemovar on the left, shell variables on the right:

nemovar eps 0.05 eps=0.05
hackcode1 eps=%eps hackcode1 eps=$eps

Note that some table(5NEMO) programs use %0, %1, %2, .... to refer to column numbers, so variable names cannot start with a digit. Upper and Lower case should be allowed.

Recall that the current command line interface already can refer to other keywords, e.g.

foobar a=1 b=’$a’

would assign the same value to both a and b.

2. An option should exist to remove a variable from the database.

3. In case there is true shared memory not associated with a filename, there needs to be a way to save and load true files.

4. When outkeys/savevars are implemented, the following style of IPC is possible:

ccdstat ccd1 outkeys=mean,rms
ccdplot ccd1 %mean

plotting a single contour of the mean value in the image.

Caveat

It is not possible to use nemovar’s in a pipe, e.g. this is NOT reliable: program1 - outkeys=bar | program2 - foo=%bar

See Also

txtpar(1NEMO) , nemopars(8NEMO) , getparam(3NEMO) , table(3NEMO)

redis/valkey https://github.com/valkey-io/valkey

Files

$NEMOVAR - currently the filename, but could be used to set a more generic IPC method.

Author

Peter

Teuben

History


7-mar-2024    Created for NEMO2024    PJT
24-jun-2024    0.4:    write dummy if NEMOVAR does not exist    PJT


Table of Contents