Download artifact once for parameterized batch job

Hello,

We are using Nomad as proof of concept on Windows clients mainly to run ASP.NET applications as services and running batch jobs.

Problem is big dependency package (~3-10GB) that we need on Windows client to run batch job. It there a way to download package once for Nomad batch job? And then use nomad job dispatch to run batch with specific arguments without downloading the artifact every time?
I would like to also provide parameters from file to Nomad batch job (this is what normally I would add to config–>args line). What is the best way to accomplish that?

What I’ve already tried:

  • use lifecycle stanza to download artifact as prestart, but when I run nomad job dispatch It will download artifact again. I looked for some conditional statement to check if it already exist and then not downloading it again but I found nothing that could work.
    lifecycle {
    hook = “prestart”
    sidecar = false
    }

One more question related to job working directory. I know that for now is it not possible to change it in the job specification ([Improvement] Configurable working directory for exec/raw_exec · Issue #2224 · hashicorp/nomad · GitHub). I used workaround with CMD do change working directory with :“cd /path/to/binary/dir/ && executable parameters…”. But using this I don’t have logs in Nomad. Do you have maybe solution for this?

Sorry for too much questions and thank you in advance for answer :slight_smile: