Experimenter CLI

Basics

Merge has a powerful command line client. It's designed to be used for both user interaction and script integration. All commands that return data support the --json flag which produces json output consumable by a script. Regular text command output should not be used for scripting. We make absolutely zero guarantees for the stability of plaintext output. Plaintext output also contains shell control characters for color coding.

Many commands deal with elements that are part of a project, such as experiments, realizations and materializations. In the absence of the --project flag, the project in use is assumed to be the calling users personal project. If a different project is desired, the --project flag may be used to specify it.

All commands support prefix shortcuts. For example the command

mergetb show experiment phobos

can be expressed as

mergetb sh exp phobos

Only commands can be abbreviated, arguments to commands cannot.

Authentication

The command line client uses the Merge OAuth2 system for authentication. Before using the client, you must login using the login command.

The API used by the mergetb tool exposes a TLS endpoint only. For portals with self signed certs, or development environments, the --cert flag may be used to augment your systems CA pool with an additional CA chain from a PEM file.

Command structure

Administrative

User management

Project management

Experiment management

Resource management

Realization management

Materialization management

Experiment Development Container (XDC) management

Scripting management

Asset management

Command reference

Administrative

Join

The join command adds your account to a Merge portal. This is the first step to getting going on any Merge portal. Your account will not be able to access the API until an administrator activates it.

$ mergetb join -h
Join a Merge portal
Usage:
mergetb join [flags]
Flags:
-h, --help help for join
Global Flags:
-c, --cert string TLS cert to use for connecting to portal
-p, --project string project to use (defaults to personal project)

Login

The login command attempts to log a user into a Merge portal instance using an OAuth2 authentication flow. Upon successful login two files are created

  • ~/.merge/id: the username used to login
  • ~/.merge/token: the token acquired from the authentication endpoint

The token is only good for a fixed period of time. How long depends on how the policy of the particular portal. A typical token lifetime is around 24 hours.

$ mergetb login -h
Login to the Merge portal
Usage:
mergetb login <username> [flags]
Flags:
-h, --help help for login
Global Flags:
-c, --cert string TLS cert to use for connecting to portal
-p, --project string project to use (defaults to personal project)

Version

Print the version of the CLI tool

$ mergetb version -h
Print CLI version
Usage:
mergetb version [flags]
Flags:
-h, --help help for version
Global Flags:
-c, --cert string TLS cert to use for connecting to portal
-p, --project string project to use (defaults to personal project)

User management

Add public key

Add a public key to the logged in user account. This key will be added to XDCs and all experiment nodes.

$ mergetb pubkey -h
Upload public key
Usage:
mergetb pubkey <keyfile> [flags]
Flags:
-h, --help help for pubkey
Global Flags:
-c, --cert string TLS cert to use for connecting to portal
-j, --json output as json
-p, --project string project to use (defaults to personal project)

List public keys

List the public keys associated with the logged in user account.

$ mergetb list pubkey -h
List public keys
Usage:
mergetb list pubkey [flags]
Flags:
-h, --help help for pubkey
Global Flags:
-c, --cert string TLS cert to use for connecting to portal
-j, --json output as json
-p, --project string project to use (defaults to personal project)

Delete public key

Remove a public key from the logged in user account. (Note this does not remove the key from existing XDCs or materialized experiments.)

$ mergetb delete pubkey -h
Delete the given key by fingerprint
Usage:
mergetb delete pubkey <fingerprint> [flags]
Flags:
-h, --help help for pubkey
Global Flags:
-c, --cert string TLS cert to use for connecting to portal
-j, --json output as json
-p, --project string project to use (defaults to personal project)

Project management

Add project member

Add a new member to a project.

$ mergetb project add -h
add a member <project> <member>
Usage:
mergetb project add [flags]
Flags:
-h, --help help for add
-r, --role string creator, maintainer, or member (default "member")
-s, --state string pending or active (default "active")
Global Flags:
-c, --cert string TLS cert to use for connecting to portal
-p, --project string project to use (defaults to personal project)

Delete project member

Delete a member from a project

$ mergetb project delete -h
delete a member
Usage:
mergetb project delete <project> <member> [flags]
Flags:
-h, --help help for delete
Global Flags:
-c, --cert string TLS cert to use for connecting to portal
-p, --project string project to use (defaults to personal project)

List project members

List the members of a project.

$ mergetb project list -h
list members
Usage:
mergetb project list <project> [flags]
Flags:
-h, --help help for list
Global Flags:
-c, --cert string TLS cert to use for connecting to portal
-p, --project string project to use (defaults to personal project)

Experiment management

New experiment

Create a new experiment. This will create a new experiment under your personal project, unless the --project flag is used to specify a different project.

The --desc flag may be used to provide an optional text description.

The --src flag may point to a topology written in Python using the Merge Experimentation Library. When specified, the Merge CLI utility will attempt to run the topology script, extract the corresponding XIR and use it as the initial source version for the new experiment.

$ mergetb new experiment -h
Create a new experiment
Usage:
mergetb new experiment <name> [flags]
Flags:
-d, --desc string description
-h, --help help for experiment
-s, --src string source mx file
Global Flags:
-c, --cert string TLS cert to use for connecting to portal
-p, --project string project to use (defaults to personal project)

Delete experiment

Delete an experiment.

$ mergetb delete experiment -h
Delete an experiment
Usage:
mergetb delete experiment <name> [flags]
Flags:
-h, --help help for experiment
Global Flags:
-c, --cert string TLS cert to use for connecting to portal
-p, --project string project to use (defaults to personal project)

Show experiment

Show experiment details

$ mergetb show experiment -h
Get experiment show
Usage:
mergetb show experiment <name> [flags]
Flags:
-h, --help help for experiment
Global Flags:
-c, --cert string TLS cert to use for connecting to portal
-j, --json output as json
-p, --project string project to use (defaults to personal project)

List experiments

List experiments belonging to a particular project. Defaults to personal project, use --project to switch projects.

$ mergetb list experiments -h
List experiments
Usage:
mergetb list experiments [flags]
Flags:
-h, --help help for experiments
Global Flags:
-c, --cert string TLS cert to use for connecting to portal
-j, --json output as json
-p, --project string project to use (defaults to personal project)

Pull

Pull experiment source XIR. The name argument is the name of the experiment and hash is the version hash you wish to pull.

$ mergetb pull -h
Pull experiment version
Usage:
mergetb pull <name> <hash> [flags]
Flags:
-h, --help help for pull
Global Flags:
-c, --cert string TLS cert to use for connecting to portal
-p, --project string project to use (defaults to personal project)

Push

Push a new version of an experiment. The source.py argument is a Python3 topology script, written using the Merge Experimentation Library. mergetb utility will attempt to run the Python script and extract XIR from the topology. The extracted XIR is then pushed to the portal as the pushed version.

$ mergetb push -h
Push experiment version
Usage:
mergetb push <name> <source.py> [flags]
Flags:
-h, --help help for push
Global Flags:
-c, --cert string TLS cert to use for connecting to portal
-p, --project string project to use (defaults to personal project)

History

Show the version history of an experiment. This command will list all the version hashes of an experiment in chronological order.

$ mergetb history -h
Get experiment history
Usage:
mergetb history <name> [flags]
Flags:
-h, --help help for history
Global Flags:
-c, --cert string TLS cert to use for connecting to portal
-p, --project string project to use (defaults to personal project)

Compile model

Compile an experiment model written with the mergemx library. This is used to confirm the model is syntactically correct.

$ ./mergetb compile -h
Compile the given MX file and summarize the produced xir
Usage:
mergetb compile <file> [flags]
Aliases:
compile, check
Flags:
-d, --dump dump generated xir (alias of -j)
-h, --help help for compile
Global Flags:
-c, --cert string TLS cert to use for connecting to portal
-j, --json output as json
-p, --project string project to use (defaults to personal project)

Resource management

List resources

List available resources.

mergetb list resources -h
List available resources
Usage:
mergetb list resources <name> [flags]
Flags:
-h, --help help for resources
Global Flags:
-c, --cert string TLS cert to use for connecting to portal
-j, --json output as json
-p, --project string project to use (defaults to personal project)

Realization management

Realize

Realize an experiment. Realization is the process of choosing and allocating resources for an experiment.

When a realization is submitted, if sufficient resources are available for the entire experiment, a pending allocation for all the selected resources will be created. This pending allocation lasts 47 seconds. During this time window the realization may be explicitly accepted or rejected by the user. No action within 47 seconds is an implicit reject. On rejection, all allocations are released. The --accept flag can be used to automatically accept a successful realization.

By default, the most recent experiment hash is used for realization. If an older version is desired, the --version flag may be used to specify a specific version hash.

$ mergetb realize -h
Realize an experiment
Usage:
mergetb realize <experiment> <name> [flags]
Flags:
-a, --accept accept any successful realization
-h, --help help for realize
-v, --version string experiment source version
Global Flags:
-c, --cert string TLS cert to use for connecting to portal
-p, --project string project to use (defaults to personal project)

Free

Free releases resources allocated to a realization and deletes the realization.

$ mergetb free -h
Unrealize an experiment
Usage:
mergetb free <experiment> <name> [flags]
Flags:
-h, --help help for free
Global Flags:
-c, --cert string TLS cert to use for connecting to portal
-p, --project string project to use (defaults to personal project)

Accept

Accept transitions a realization in the pending state to the accepted state. This means that the allocated resources will belong to the calling user until explicitly freed.

$ mergetb accept -h
Accept a realization
Usage:
mergetb accept <experiment> <name> [flags]
Flags:
-h, --help help for accept
Global Flags:
-c, --cert string TLS cert to use for connecting to portal
-p, --project string project to use (defaults to personal project)

Reject

Reject deletes a pending realization and removes all associated allocations.

$ mergetb reject -h
Reject a realization
Usage:
mergetb reject <experiment> <name> [flags]
Flags:
-h, --help help for reject
Global Flags:
-c, --cert string TLS cert to use for connecting to portal
-p, --project string project to use (defaults to personal project)

Show realization

Shows the details of a realization.

$ mergetb show realization -h
Show realization show
Usage:
mergetb show realization <experiment> <name> [flags]
Flags:
-h, --help help for realization
Global Flags:
-c, --cert string TLS cert to use for connecting to portal
-j, --json output as json
-p, --project string project to use (defaults to personal project)

List realizations

List the realizations associated with a particular experiment.

$ mergetb list realizations -h
List experiment realizations
Usage:
mergetb list realizations <experiment> [flags]
Flags:
-h, --help help for realizations
Global Flags:
-c, --cert string TLS cert to use for connecting to portal
-j, --json output as json
-p, --project string project to use (defaults to personal project)

Materialization management

Materialize

Materialize a realization.

$ mergetb materialize -h
Materialize an experiment
Usage:
mergetb materialize <experiment> <realization> [flags]
Flags:
-h, --help help for materialize
Global Flags:
-c, --cert string TLS cert to use for connecting to portal
-p, --project string project to use (defaults to personal project)

Dematerialize

Dematerialize a materialization.

$ mergetb dematerialize -h
Dematerialize an experiment
Usage:
mergetb dematerialize <experiment> <realization> [flags]
Flags:
-h, --help help for dematerialize
Global Flags:
-c, --cert string TLS cert to use for connecting to portal
-p, --project string project to use (defaults to personal project)

Status

Check on the status of a materialization.

$ mergetb status -h
Get materialization status
Usage:
mergetb status <experiment> <realization> [flags]
Flags:
-h, --help help for status
Global Flags:
-c, --cert string TLS cert to use for connecting to portal
-p, --project string project to use (defaults to personal project)

Show materialization

Show the details of a materialization.

$ mergetb show materialization -h
Get materialization show
Usage:
mergetb show materialization <experiment> <realization> [flags]
Flags:
-h, --help help for materialization
Global Flags:
-c, --cert string TLS cert to use for connecting to portal
-j, --json output as json
-p, --project string project to use (defaults to personal project)

Experiment Development Container (XDC) management

Create XDC

Create a new XDC in an experiment workspace.

$ mergetb new xdc -h
Spawn a new XDC under the given project & experiment
Usage:
mergetb new xdc <experiment> <xdcname> [flags]
Flags:
-h, --help help for xdc
Global Flags:
-c, --cert string TLS cert to use for connecting to portal
-j, --json output as json
-p, --project string project to use (defaults to personal project)

Delete XDC

Delete an XDC from an experiment workspace.

$ mergetb delete xdc -h
delete an existing XDC
Usage:
mergetb delete xdc <experiment> <name> [flags]
Flags:
-h, --help help for xdc
Global Flags:
-c, --cert string TLS cert to use for connecting to portal
-j, --json output as json
-p, --project string project to use (defaults to personal project)

List XDCs

List all XDCs in an experiment workspace.

$ mergetb list xdc -h
List XDCs in a given project & experiment
Usage:
mergetb list xdc <experiment> [flags]
Flags:
-h, --help help for xdc
Global Flags:
-c, --cert string TLS cert to use for connecting to portal
-j, --json output as json
-p, --project string project to use (defaults to personal project)

Scripting management

wait

Wait for an asynchronous event (materialization, dematerialization, or realization free) to complete.

$ mergetb wait -h
Wait for events to complete in a Merge portal
Usage:
mergetb wait [command]
Available Commands:
dematerialize Wait for the given materialization to be fully dematerialize
free Wait for the given realization to be fully freed (including any existing materialization)
materialize Wait for the given materialization to be fully active
Flags:
-h, --help help for wait
Global Flags:
-c, --cert string TLS cert to use for connecting to portal
-j, --json output as json
-p, --project string project to use (defaults to personal project)
Use "mergetb wait [command] --help" for more information about a command.

The wait subcommands all take two arguments (along with the implicit project id): experiment id, and realization id.

$ mergetb wait free -h
Wait for the given realization to be fully freed (including any existing materialization)
Usage:
mergetb wait free <eid> <rid> [flags]
Flags:
-h, --help help for free
Global Flags:
-c, --cert string TLS cert to use for connecting to portal
-j, --json output as json
-p, --project string project to use (defaults to personal project)

Asset management

New asset

Create a new asset (experiment storage).

$ mergetb new asset -h
Create a new static asset object
Usage:
mergetb new asset [command]
Available Commands:
blockdevice Create a new block device
filesystem Create a new filesystem mount
Flags:
-h, --help help for asset
Global Flags:
-c, --cert string TLS cert to use for connecting to portal
-j, --json output as json
-p, --project string project to use (defaults to personal project)

Create a new filesystem asset on given sites.

$ mergetb new asset filesystem -h
Usage:
mergetb new asset filesystem <site[,site]> <name> <size> [flags]
Flags:
-h, --help help for filesystem
Global Flags:
-c, --cert string TLS cert to use for connecting to portal
-j, --json output as json
-p, --project string project to use (defaults to personal project)

Delete asset

Delete an asset (experiment storage).

$ mergetb delete asset -h
Usage:
mergetb delete asset <site[,site]> <name> [flags]
Flags:
-h, --help help for asset
Global Flags:
-c, --cert string TLS cert to use for connecting to portal
-j, --json output as json
-p, --project string project to use (defaults to personal project)

Show asset

Show details about a specific asset.

$ mergetb show asset -h
Usage:
mergetb show asset <site[,site]> <name> [flags]
Flags:
-h, --help help for asset
Global Flags:
-c, --cert string TLS cert to use for connecting to portal
-j, --json output as json
-p, --project string project to use (defaults to personal project)

List assets

List details for all assets under the current project.

$ mergetb list asset -h
List project assets
Usage:
mergetb list assets [flags]
Flags:
-h, --help help for assets
Global Flags:
-c, --cert string TLS cert to use for connecting to portal
-j, --json output as json
-p, --project string project to use (defaults to personal project)