genestack-application-manager

genestack-application-manager is installed with the Python Client Library and can be accessed from a terminal by typing genestack-application-manager.

Usage

This script can be used both in interactive shell mode and in static command-line mode:

usage: __main__.py [-H <host>] [-u <user>] [-p <password>] [--token <api-token>]
                   [--debug] [--show-logs] [-h] [-v]
                   [<command>]

The Genestack Application Manager is a command-line utility that allows you to
upload and manage your applications on a specific Genestack instance

positional arguments:
  <command>                   "info", "install", "versions", "applications",
                              "stable", "remove", "reload", "invoke",
                              "visibility", "release", "status" or empty to use
                              shell

optional arguments:
  -h, --help                  show this help message and exit
  -v, --version               show version

connection:
  -H <host>, --host <host>    server host
  -u <user>, --user <user>    user alias from settings or email
  -p <password>, --password <password>
                              user password
  --token <api-token>         API token to be used instead of the login and
                              password
  --debug                     include server stacktrace into error messages
                              (implies --show-logs)
  --show-logs                 print application logs received from server to
                              stdout

You can get a description for every command by typing:

$ genestack-application-manager command -h

In shell mode, type help to get a list of available commands. Use help command to get help for a specific command.

See Connecting to a Genestack instance for more information about connection arguments.

genestack-application-manager exits with 0 return code in case of success, 1 in case of various nondescript errors, and 13 if server requires newer Python Client version.

Commands

  • applications:

    usage: __main__.py applications [-h] [-H <host>] [-u <user>] [-p <password>]
                                    [--token <api-token>] [--debug] [--show-logs]
    
    Show information about available applications.
    
    optional arguments:
      -h, --help                  show this help message and exit
    
    connection:
      -H <host>, --host <host>    server host
      -u <user>, --user <user>    user alias from settings or email
      -p <password>, --password <password>
                                  user password
      --token <api-token>         API token to be used instead of the login and
                                  password
      --debug                     include server stacktrace into error messages
                                  (implies --show-logs)
      --show-logs                 print application logs received from server to
                                  stdout
    
  • info:

    usage: __main__.py info [-h] [-f] [-F] [--vendor]
                            <jar_file_or_folder> [<jar_file_or_folder> ...]
    
    Display information about an application's JAR file.
    
    command arguments:
      -f, --with-filename   show file names for each JAR
      -F, --no-filename     do not show file names
      --vendor              show only vendor for each JAR file
      <jar_file_or_folder>  file to upload or folder with single JAR file inside
                            (recursively)
    
    optional arguments:
      -h, --help            show this help message and exit
    
  • install:

    usage: __main__.py install [-h] [-H <host>] [-u <user>] [-p <password>]
                               [--token <api-token>] [--debug] [--show-logs] [-f]
                               [-o] [-s] [-S <scope>] [-i <visibility>] [-n]
                               <version> <jar_file_or_folder>
                               [<jar_file_or_folder> ...]
    
    Upload and install an application's JAR file to a Genestack instance.
    
    command arguments:
      -f, --force                 Run installation without any prompts (use with
                                  caution)
      -o, --override              overwrite old version of the applications with the
                                  new one
      -s, --stable                mark installed applications as stable
      -S <scope>, --scope <scope>
                                  scope in which application will be stable (default
                                  is 'user'): system | user | session
      -i <visibility>, --visibility <visibility>
                                  set initial visibility (use `-i organization` for
                                  setting organization visibility or `-i
                                  <group_accession>` for group visibility)
      -n, --no-wait               Don't wait until all installed applications will
                                  be completely loaded
      <version>                   version of applications to upload
      <jar_file_or_folder>        file to upload or folder with single JAR file
                                  inside (recursively)
    
    optional arguments:
      -h, --help                  show this help message and exit
    
    connection:
      -H <host>, --host <host>    server host
      -u <user>, --user <user>    user alias from settings or email
      -p <password>, --password <password>
                                  user password
      --token <api-token>         API token to be used instead of the login and
                                  password
      --debug                     include server stacktrace into error messages
                                  (implies --show-logs)
      --show-logs                 print application logs received from server to
                                  stdout
    
  • invoke:

    usage: __main__.py invoke [-h] [-H <host>] [-u <user>] [-p <password>]
                              [--token <api-token>] [--debug] [--show-logs]
                              <appId> <method> [<args> [<args> ...]]
    
    Invoke method of a stable application.
    
    command arguments:
      <appId>                     application identifier
      <method>                    application method to call
      <args>                      application method to call
    
    optional arguments:
      -h, --help                  show this help message and exit
    
    connection:
      -H <host>, --host <host>    server host
      -u <user>, --user <user>    user alias from settings or email
      -p <password>, --password <password>
                                  user password
      --token <api-token>         API token to be used instead of the login and
                                  password
      --debug                     include server stacktrace into error messages
                                  (implies --show-logs)
      --show-logs                 print application logs received from server to
                                  stdout
    
  • release:

    usage: __main__.py release [-h] [-H <host>] [-u <user>] [-p <password>]
                               [--token <api-token>] [--debug] [--show-logs]
                               <appId> <version> <newVersion>
    
    Create released application from testing one
    
    command arguments:
      <appId>                     application identifier
      <version>                   application version
      <newVersion>                version of released application (must differ from
                                  other version of this application)
    
    optional arguments:
      -h, --help                  show this help message and exit
    
    connection:
      -H <host>, --host <host>    server host
      -u <user>, --user <user>    user alias from settings or email
      -p <password>, --password <password>
                                  user password
      --token <api-token>         API token to be used instead of the login and
                                  password
      --debug                     include server stacktrace into error messages
                                  (implies --show-logs)
      --show-logs                 print application logs received from server to
                                  stdout
    
  • reload:

    usage: __main__.py reload [-h] [-H <host>] [-u <user>] [-p <password>]
                              [--token <api-token>] [--debug] [--show-logs]
                              <version> <appId> [<appId> ...]
    
    Reload a specific version of an application.
    
    command arguments:
      <version>                   application version
      <appId>                     ID of the application to be marked as stable
    
    optional arguments:
      -h, --help                  show this help message and exit
    
    connection:
      -H <host>, --host <host>    server host
      -u <user>, --user <user>    user alias from settings or email
      -p <password>, --password <password>
                                  user password
      --token <api-token>         API token to be used instead of the login and
                                  password
      --debug                     include server stacktrace into error messages
                                  (implies --show-logs)
      --show-logs                 print application logs received from server to
                                  stdout
    
  • remove:

    usage: __main__.py remove [-h] [-H <host>] [-u <user>] [-p <password>]
                              [--token <api-token>] [--debug] [--show-logs] [-f]
                              <version> <appId> [<appId> ...]
    
    Remove a specific version of an application.
    
    command arguments:
      -f, --force                 Remove without any prompts (use with caution)
      <version>                   application version
      <appId>                     identifier of the application to remove (or `ALL`
                                  for removing all _your_ applications with
                                  specified version)
    
    optional arguments:
      -h, --help                  show this help message and exit
    
    connection:
      -H <host>, --host <host>    server host
      -u <user>, --user <user>    user alias from settings or email
      -p <password>, --password <password>
                                  user password
      --token <api-token>         API token to be used instead of the login and
                                  password
      --debug                     include server stacktrace into error messages
                                  (implies --show-logs)
      --show-logs                 print application logs received from server to
                                  stdout
    
  • stable:

    usage: __main__.py stable [-h] [-H <host>] [-u <user>] [-p <password>]
                              [--token <api-token>] [--debug] [--show-logs]
                              [-S <scope>]
                              <version> <appId> [<appId> ...]
    
    Mark applications with the specified version as stable.
    
    command arguments:
      <version>                   applications version or '-' (hyphen) to remove
                                  stable version
      <appId>                     ID of the application to be marked as stable
      -S <scope>, --scope <scope>
                                  scope in which the application will be stable
                                  (default is 'user'): system | user | session
    
    optional arguments:
      -h, --help                  show this help message and exit
    
    connection:
      -H <host>, --host <host>    server host
      -u <user>, --user <user>    user alias from settings or email
      -p <password>, --password <password>
                                  user password
      --token <api-token>         API token to be used instead of the login and
                                  password
      --debug                     include server stacktrace into error messages
                                  (implies --show-logs)
      --show-logs                 print application logs received from server to
                                  stdout
    
  • status:

    usage: __main__.py status [-h] [-H <host>] [-u <user>] [-p <password>]
                              [--token <api-token>] [--debug] [--show-logs] [-s]
                              <version> <appId> [<appId> ...]
    
    Shows loading status of application and additional loading info
    
    command arguments:
      <version>                   application version
      <appId>                     identifier of the application
      -s, --state-only            show only id and state, without error descriptions
    
    optional arguments:
      -h, --help                  show this help message and exit
    
    connection:
      -H <host>, --host <host>    server host
      -u <user>, --user <user>    user alias from settings or email
      -p <password>, --password <password>
                                  user password
      --token <api-token>         API token to be used instead of the login and
                                  password
      --debug                     include server stacktrace into error messages
                                  (implies --show-logs)
      --show-logs                 print application logs received from server to
                                  stdout
    
  • versions:

    usage: __main__.py versions [-h] [-H <host>] [-u <user>] [-p <password>]
                                [--token <api-token>] [--debug] [--show-logs] [-s]
                                [-i] [-l] [-r] [-o]
                                <appId>
    
    Show information about available applications.
    
    command arguments:
      -s                          display stable scopes in output (S: System, U:
                                  User, E: sEssion)
      -i                          display visibility of each version
      -l                          display loading state of application with specific
                                  version
      -r                          display release state of version
      -o                          show only versions owned by current user
      <appId>                     application identifier to show versions
    
    optional arguments:
      -h, --help                  show this help message and exit
    
    connection:
      -H <host>, --host <host>    server host
      -u <user>, --user <user>    user alias from settings or email
      -p <password>, --password <password>
                                  user password
      --token <api-token>         API token to be used instead of the login and
                                  password
      --debug                     include server stacktrace into error messages
                                  (implies --show-logs)
      --show-logs                 print application logs received from server to
                                  stdout
    
  • visibility:

    usage: __main__.py visibility [-h] [-H <host>] [-u <user>] [-p <password>]
                                  [--token <api-token>] [--debug] [--show-logs] [-r]
                                  <appId> <version> <level>
                                  [<groups_accessions> [<groups_accessions> ...]]
    
    Set or remove visibility for application
    
    command arguments:
      -r, --remove                Specifies if visibility must be removed (by
                                  default specific visibility will be added)
      <appId>                     application identifier
      <version>                   application version
      <level>                     Visibility level which will be set to application:
                                  group | organization | all
      <groups_accessions>         Accessions of groups for 'group' visibility rule
    
    optional arguments:
      -h, --help                  show this help message and exit
    
    connection:
      -H <host>, --host <host>    server host
      -u <user>, --user <user>    user alias from settings or email
      -p <password>, --password <password>
                                  user password
      --token <api-token>         API token to be used instead of the login and
                                  password
      --debug                     include server stacktrace into error messages
                                  (implies --show-logs)
      --show-logs                 print application logs received from server to
                                  stdout
    

Usage examples

If -u is not specified, the default user is used.

Installing applications

  • If you want to install a new JAR file containing applications, simply type:

    genestack-application-manager install my-version path/to/file.jar
    
  • If your JAR file is located in a specific folder, and this folder and its subfolders do not contain any other JAR file, you can specify the path to the folder instead of the full path to the JAR file. In that case, the folder and its subfolders will be searched for JAR files. If no JAR file or more than one JAR file is found, an error is returned.

    genestack-application-manager install my-version path/to/folder

  • If you want to upload a JAR file and also mark all the applications inside it as stable for your current user, you can use -s option of the install command (the default scope for marking applications as stable is user):

    genestack-application-manager install -s my-version path/to/file.jar
    
  • If you want to make an applications stable only for your session, you should specify -S session:

    genestack-application-manager install -s -S session my-version path/to/file.jar
    
  • Otherwise, you can use the stable command after installing the JAR file:

    JAR=path/to/file.jar
    VERSION=my-version
    genestack-application-manager install $VERSION $JAR
    for A in $(genestack-application-manager info $JAR | tail -n+3); do
        genestack-application-manager stable -S system $VERSION $A
    done
    
  • If you want to reinstall your applications later with the same version (whether or not that version was marked as stable), you can simply use the -o option for the install command

    This option works exactly as removing the old version before uploading the new one, so there are two things to keep in mind: - -o can be used to overwrite only your versions, because you cannot overwrite or remove versions uploaded by other users; - -o removes the global stable mark, so if you overwrite a globally stable version, then after that no globally stable version will be available on the system

    genestack-application-manager install -o my-version path/to/file.jar

  • Sometimes you may want to upload a JAR file with many applications, and only mark as stable one of them. In this case you should use the install and stable commands:

    genestack-application-manager install my-version path/to/file.jar
    genestack-application-manager stable my-version vendor/appIdFromJarFile
    

Removing all of your applications

  • If you want to remove all your applications, you can use the following bash script:

    for A in $(genestack-application-manager applications); do
        for V in $(genestack-application-manager versions -o $A); do
            genestack-application-manager remove $V $A
        done
    done
    
  • And if you want to remove only those your applications that were loaded from a specific JAR file, then:

    JAR=path/to/file.jar
    for A in $(genestack-application-manager info $JAR | tail -n+3); do
        for V in $(genestack-application-manager versions -o $A); do
            genestack-application-manager remove $V $A
        done
    done