Galaxy Configuration

Examples

The most complete and up-to-date documentation for configuring Galaxy job destinations is Galaxy’s job_conf.sample.yml file (check it out on GitHub). These examples just provide a different Pulsar-centric perspective on some of the documentation in that file.

For which Pulsar servers each Galaxy release is expected to work with, see Galaxy Compatibility.

Note

Galaxy’s job configuration was historically expressed as XML (job_conf.xml). The YAML format (job_conf.yml) is now the recommended form and is used throughout the examples below. The XML form remains supported but is deprecated.

In the YAML schema, what used to be called a plugin is configured under runners, and what used to be called a destination is configured under execution.environments. Tools are mapped to environments under the top-level tools list.

Targeting a Linux Cluster (Pulsar Web Server)

The following Galaxy job_conf.yml assumes you have a very typical Galaxy setup - there is a local, smaller cluster that mounts all of Galaxy’s data (so no need for the Pulsar) and a bigger shared resource that cannot mount Galaxy’s files requiring the use of the Pulsar. This variant routes some larger assembly jobs to the remote cluster - namely the trinity and abyss tools.

runners:
  drmaa:
    load: galaxy.jobs.runners.drmaa:DRMAAJobRunner
  pulsar:
    load: galaxy.jobs.runners.pulsar:PulsarRESTJobRunner

execution:
  default: local_cluster
  environments:
    local_cluster:
      runner: drmaa
      native_specification: '-P littlenodes -R y -pe threads 4'
    remote_cluster:
      runner: pulsar
      url: http://remotelogin:8913/
      submit_native_specification: '-P bignodes -R y -pe threads 16'
      # Look for the trinity package at the remote location - define
      # tool_dependency_dir in the Pulsar app.yml file.
      dependency_resolution: remote

tools:
- id: trinity
  environment: remote_cluster
- id: abyss
  environment: remote_cluster

For this configuration, on the Pulsar side, be sure to also set a DRMAA_LIBRARY_PATH in local_env.sh, install the Python drmaa module, and configure a DRMAA job manager for Pulsar in app.yml as described in Job Managers.

Targeting a Linux Cluster (Pulsar over Message Queue)

For Pulsar instances sitting behind a firewall, a web server may be impossible. If the same Pulsar configuration discussed above is additionally configured with a message_queue_url of amqp://rabbituser:rabb8pa8sw0d@mqserver:5672// in app.yml, the following Galaxy configuration will cause this message queue to be used for communication. This is also likely better for large file transfers since typically your production Galaxy server will be sitting behind a high-performance proxy while Pulsar will not.

runners:
  drmaa:
    load: galaxy.jobs.runners.drmaa:DRMAAJobRunner
  pulsar_default:
    load: galaxy.jobs.runners.pulsar:PulsarMQJobRunner
    # Must tell Pulsar where to send files.
    galaxy_url: https://galaxy.example.org
    # Message Queue Connection (should match message_queue_url in Pulsar's app.yml).
    amqp_url: amqp://rabbituser:rabb8pa8sw0d@mqserver.example.org:5672//
  pulsar_hugenodes:
    load: galaxy.jobs.runners.pulsar:PulsarMQJobRunner
    galaxy_url: https://galaxy.example.org
    amqp_url: amqp://rabbituser:rabb8pa8sw0d@mqserver.example.org:5672//
    # Set 'manager' to reference a named Pulsar job manager.
    manager: hugenodes

execution:
  default: local_cluster
  environments:
    local_cluster:
      runner: drmaa
      native_specification: '-P littlenodes -R y -pe threads 4'
    bignodes_cluster:
      runner: pulsar_default
      # Tell Galaxy where files are being staged on the remote system so the
      # web server can simply ask for this information.
      jobs_directory: /path/to/remote/pulsar/files/staging/
      submit_native_specification: '-P bignodes -R y -pe threads 16'
    hugenodes_cluster:
      runner: pulsar_hugenodes
      jobs_directory: /path/to/remote/pulsar/files/staging/
      submit_native_specification: '-P hugenodes -R y -pe threads 128'

tools:
- id: trinity
  environment: bignodes_cluster
- id: abyss
  environment: hugenodes_cluster

The manager param on the pulsar_hugenodes runner allows for using the same AMQP server and vhost (in this example, the default / vhost) between multiple Pulsar servers, or submitting jobs to multiple managers (see: Job Managers) on the same Pulsar server.

In this example, the _default_ job manager will be used for trinity jobs, and the hugenodes job manager will be used for abyss jobs.

Note

If you only need to define different submit_native_specification params on the same cluster for these tools/environments, it is not necessary to use a separate manager - multiple environments can reference the same runner. This example is for documentation purposes.

All of the amqp_* options documented in app.yml.sample can be specified as parameters under a PulsarMQJobRunner runner. These configure Galaxy’s connection to the AMQP server (rather than Pulsar’s connection, which is configured in Pulsar’s app.yml). Additionally, specifying the persistence_directory param controls where AMQP acknowledgement receipts will be stored on the Galaxy side.

For those interested in this deployment option and new to Message Queues, there is more documentation in Message Queues with Galaxy and Pulsar.

Additionally, Pulsar ships with an RSync and SCP transfer action rather than making use of the HTTP transport method:

runners:
  pulsar_mq:
    load: galaxy.jobs.runners.pulsar:PulsarMQJobRunner
    # Must tell Pulsar where to send files.
    galaxy_url: https://galaxyserver
    # Message Queue Connection (should match message_queue_url in Pulsar's
    # app.yml). pyamqp may be necessary over amqp if SSL is used.
    amqp_url: pyamqp://rabbituser:rabb8pa8sw0d@mqserver:5671//?ssl=1

execution:
  default: remote_cluster
  environments:
    remote_cluster:
      runner: pulsar_mq
      # Must match the staging_directory configured on the Pulsar side; the
      # client computes every remote path from it before contacting Pulsar.
      jobs_directory: /data/pulsar/staging
      # Provide connection information, should look like:
      #
      #     paths:
      #         - path: /home/vagrant/  # Home directory for galaxy user
      #           action: remote_rsync_transfer # _rsync_ and _scp_ are available
      #           ssh_user: vagrant
      #           ssh_host: galaxy-vm.host.edu
      #           ssh_port: 22
      file_action_config: file_actions.yaml
      # Provide an SSH key for access to the local $GALAXY_ROOT, should be
      # accessible with the username/hostname provided in file_actions.yaml.
      ssh_key: |
        -----BEGIN RSA PRIVATE KEY-----
        .............
      # Allow the remote end to know who is running the job, may need to
      # append @domain.edu after it. Only used if the "DRMAA (via external
      # users) manager" is used.
      submit_user: $__user_name__

tools:
- id: trinity
  environment: remote_cluster
- id: abyss
  environment: remote_cluster

Declaring the Remote Pulsar Version

When a Pulsar environment in Galaxy’s job_conf.yml sets jobs_directory (as message queue and relay environments typically do), Galaxy builds the job setup itself and never asks the remote Pulsar for its version, so its minimum Pulsar version checks can’t be applied. To have Galaxy check against the version the remote Pulsar is running, set remote_pulsar_version on that same environment in Galaxy’s job_conf.yml (nothing changes on the Pulsar side):

execution:
  environments:
    pulsar_mq:
      runner: pulsar_mq
      jobs_directory: /data/pulsar/staging
      remote_pulsar_version: "0.15.16"

Quote the value - YAML reads an unquoted 0.20 as the number 0.2, so Pulsar rejects non-string values. Update it when the remote Pulsar is upgraded. Without it Galaxy assumes a current Pulsar, so declare it for any remote older than 0.15.13 - older remotes don’t understand how Galaxy describes discovered outputs, and those outputs are silently lost.

Kubernetes, TES, and GCP Batch environments don’t need it when pulsar_container_image is a published galaxy/pulsar-pod-staging image (including Galaxy’s default) - Pulsar knows the version each was built from.

Targeting GCP Batch, Kubernetes, or TES

Check out Containers for information on using Pulsar with these container-native execution environments. The pulsar_k8s, pulsar_tes, and pulsar_gcp runners (and corresponding environments) in Galaxy’s job_conf.sample.yml give a starting point for each.

Generating Galaxy Metadata in Pulsar Jobs

This option is often referred to as remote metadata.

Typically Galaxy will process Pulsar job outputs and generate metadata on the Galaxy server. One can force this to happen inside Pulsar jobs (wherever the Pulsar job runs). This is similar to the way that non-Pulsar Galaxy jobs work: job output metadata is generated at the end of a standard Galaxy job, not by the Galaxy server.

This option comes with a downside that you should be aware of, explained in Issue #234. Unless you are seeing high load on your Galaxy server while finishing Pulsar jobs, it is safest to use the default (remote metadata disabled).

In order to enable the remote metadata option:

  1. Set GALAXY_VIRTUAL_ENV to the path to Galaxy’s virtualenv (or one containing Galaxy’s dependencies) when starting Pulsar. This can be done in the local_env.sh file. Instructions on setting up a Galaxy virtualenv can be found in the Galaxy Docs.

  2. Instruct Pulsar with the path to a copy of Galaxy at the same version as your Galaxy server. This can either be done by setting GALAXY_HOME in local_env.sh, or by setting galaxy_home in app.yml.

  3. In the Galaxy job_conf.yml execution environment(s) you want to enable remote metadata on, set the following params:

    remote_metadata: true
    remote_property_galaxy_home: /path/to/galaxy
    

    and one of either:

    use_metadata_binary: true
    

    or:

    use_remote_datatypes: false
    

Simple Windows Pulsar Web Server

Pulsar deployment on Windows is uncommon, but supported. The following Galaxy job_conf.yml assumes you have deployed a simple Pulsar web server to the Windows host windowshost.examle.com on the default port (8913) with a private_token (defined in app.yml) of 123456789changeme. Most Galaxy jobs will just use Galaxy’s local job runner but msconvert and proteinpilot will be sent to the Pulsar server on windowshost.examle.com. Sophisticated tool dependency resolution is not available for Windows-based Pulsar servers so ensure the underlying applications are on Pulsar’s path.

runners:
  local:
    load: galaxy.jobs.runners.local:LocalJobRunner
  pulsar:
    load: galaxy.jobs.runners.pulsar:PulsarLegacyJobRunner

execution:
  default: local
  environments:
    local:
      runner: local
    win_pulsar:
      runner: pulsar
      url: https://windowshost.examle.com:8913/
      private_token: 123456789changeme

tools:
- id: msconvert
  environment: win_pulsar
- id: proteinpilot
  environment: win_pulsar

This example uses PulsarLegacyJobRunner, which is the Pulsar runner with default parameters matching those of the old LWR job runner. It disables features (such as remote dependency resolution and remote metadata) that newer Pulsar servers handle but Windows-based servers typically cannot. For Linux Pulsar servers, prefer PulsarRESTJobRunner (shown in the examples above).

Data Staging

Most of the parameters settable in Galaxy’s job configuration file job_conf.yml are straight forward - but specifying how Galaxy and the Pulsar stage various files may benefit from more explanation.

default_file_action defined in Galaxy’s job_conf.yml describes how inputs, outputs, indexed reference data, etc… are staged. The default transfer has Galaxy initiate HTTP transfers. This makes little sense in the context of message queues so this should be set to remote_transfer, which causes Pulsar to initiate the file transfers. Additional options are available including none, copy, and remote_copy.

In addition to this default - paths may be overridden based on various patterns to allow optimization of file transfers in production infrastructures where various systems mount different file stores and file stores with different paths on different systems.

To do this, the defined Pulsar execution environment in Galaxy’s job_conf.yml may specify a parameter named file_action_config. This needs to be a config file path (if relative, relative to Galaxy’s root) like config/pulsar_actions.yaml (can be YAML or JSON - but older Galaxy’s only supported JSON). The following captures available options:

paths: 
  # Use transfer (or remote_transfer) if only Galaxy mounts a directory.
  - path: /galaxy/files/store/1
    action: transfer

  # Use copy (or remote_copy) if remote Pulsar server also mounts the directory
  # but the actual compute servers do not.
  - path: /galaxy/files/store/2
    action: copy

  # If Galaxy, the Pulsar, and the compute nodes all mount the same directory
  # staging can be disabled altogether for given paths.
  - path: /galaxy/files/store/3
    action: none

  # Following block demonstrates specifying paths by globs as well as rewriting
  # unstructured data in .loc files.
  - path: /mnt/indices/**/bwa/**/*.fa
    match_type: glob
    path_types: unstructured  # Set to *any* to apply to defaults & unstructured paths.
    action: transfer
    depth: 1  # Stage whole directory with job and not just file.

  # Following block demonstrates rewriting paths without staging. Useful for
  # instance if Galaxy's data indices are mounted on both servers but with
  # different paths.
  - path: /galaxy/data
    path_types: unstructured
    action: rewrite
    source_directory: /galaxy/data
    destination_directory: /work/galaxy/data

  # The following demonstrates use of the Rsync transport layer
  - path: /galaxy/files/
    action: remote_rsync_transfer
    # Additionally the action remote_scp_transfer is available which behaves in
    # an identical manner
    ssh_user: galaxy
    ssh_host: f.q.d.n
    ssh_port: 22

# See action_mapper.py for explaination of mapper types:
# - input: Galaxy input datasets and extra files.
# - config: Galaxy config and param files.
# - tool: Files from tool's tool_dir (for now just wrapper if available).
# - workdir: Input work dir files - e.g.task-split input file.
# - metadata: Input metadata files.
# - output: Galaxy output datasets in their final home.
# - output_workdir:  Galaxy from_work_dir output paths and other files (e.g. galaxy.json)
# - output_metadata: Meta job and data files (e.g. Galaxy metadata generation files and
#                    metric instrumentation files)
# - unstructured: Other fixed tool parameter paths (likely coming from tool data, but not
#                 nessecarily). Not sure this is the best name...

Rewriting Container Image Paths for cvmfsexec

The rewrite action is also how you remap a Singularity/Apptainer container image path when the compute node exposes CVMFS at a non-standard path via cvmfsexec in mountrepo mode (see Containers). Galaxy resolves the image against the real /cvmfs on the Galaxy server, but on the compute node the repository is bind-mounted under the per-job directory, so the image path baked into the job command must be rewritten. The resolved container image is remapped via the dedicated container path type (distinct from the unstructured tool-parameter paths above). Add the following to the destination’s file_actions (or file_action_config):

paths:
  - path: /cvmfs/singularity.galaxyproject.org
    path_types: container
    action: rewrite
    source_directory: /cvmfs/singularity.galaxyproject.org
    destination_directory: __PULSAR_JOB_DIRECTORY__/.cvmfsexec/dist/cvmfs/singularity.galaxyproject.org

The container path type matches only the resolved container image path, so this rule never affects tool parameters. The __PULSAR_JOB_DIRECTORY__ token is replaced by the Pulsar server with the absolute per-job directory.

Note

Use __PULSAR_JOB_DIRECTORY__ only in path_types: container rules. Pulsar substitutes it in the job’s command line, and a container rewrite reaches the command line and nothing else. An unstructured rule also rewrites staged config file contents, where the token is currently left unresolved - a known limitation rather than an intended restriction.