Cromwell execution directory

Post author
Stephen Fleming

Cromwell question: is there an environment variable that I can access from within a running task's command block that specifies the Cromwell execution directory (google bucket) ?

Comments

4 comments

  • Comment author
    Jason Cerrato

    Hi Stephen,

    Great question! Let me check on this and get back to you.

    Kind regards,

    Jason

    0
  • Comment author
    Jason Cerrato

    Hi Stephen,

    There isn't an environment variable for this, but you could strip the path out from a file that is localized to understand the path. I hope this helps!
     
    Kind regards,
    Jason
    0
  • Comment author
    Stephen Fleming
    • Edited

    Thanks Jason!

     

    With a suggestion from Luca D'Alessio, I have attempted this, which seems to work:

    BUCKET=$(cat gcs_delocalization.sh | grep -o '"gs:\/\/.*/call' | sed 's/\/call/"/' | head -n 1)

     

    Full WDL example:

    task run_task {
      # Docker image
      String? docker_image = "ubuntu:16.04"

      # Hardware-related inputs
      String? hardware_zones = "us-east1-d us-east1-c us-central1-a us-central1-c us-west1-b"
      Int? hardware_disk_size_GB = 50
      Int? hardware_preemptible_tries = 0
      Int? hardware_num_cpu = 4
      Int? hardware_boot_disk_size_GB = 15
      Int? hardware_memory_GB = 15

      command {
        BUCKET=$(cat gcs_delocalization.sh | grep -o '"gs:\/\/.*/call' | sed 's/\/call/"/' | head -n 1)
        echo "Variable BUCKET contains" >> out.log
        echo "$BUCKET" >> out.log
      }

      output {
        File log = "out.log"
      }

      runtime {
        docker: "${docker_image}"
        bootDiskSizeGb: hardware_boot_disk_size_GB
        disks: "local-disk ${hardware_disk_size_GB} HDD"
        memory: "${hardware_memory_GB}G"
        cpu: hardware_num_cpu
        zones: "${hardware_zones}"
        preemptible: hardware_preemptible_tries
        maxRetries: 0
      }
    }

    workflow test {
      call run_task
      output {
        File log = run_task.log
      }
    }
    1
  • Comment author
    Jason Cerrato

    Hi Stephen,

    That makes sense! I'm glad to see you've found a solution that works for you. Thank you for sharing this, as it will be helpful to other users.

    If we can help with anything else, please let us know.

    Kind regards,

    Jason

    0

Please sign in to leave a comment.