Skip to content
This repository was archived by the owner on Sep 25, 2026. It is now read-only.
This repository was archived by the owner on Sep 25, 2026. It is now read-only.

Obscure use of tmp.sh to pass pipeline id #106

Closed

Description

run_train_pipeline.py writes a file $(Build.SourcesDirectory)/tmp.sh that is then sourced by the pipeline.

This is not explained, and not easy to understand.

Comments would help, but it would be cleaner if run_train_pipeline.py accepted an argument which is a file name to which it writes the pipeline id, and the pipeline code was changed to something like:

tmpfile=$(mktemp)
python $(Build.SourcesDirectory)/ml_service/pipelines/run_train_pipeline.py --pipeline-id "$tmpfile"
echo "##vso[task.setvariable variable=AMLPIPELINEID;isOutput=true]$(cat $tmpfile)"
rm "$tmpfile"

Activity

  1. dtzar commented on Nov 26, 2019

    @dtzar
    Contributor

    Alternative approaches - but thought I'd still keep the one as-is as it is most robust to do whatever inside a shell script.

    vso_pipeline_name = "##vso[task.setvariable variable=pipeline_name;isOutput=true]{}".format(pipeline_name)
        print(vso_pipeline_name)
    

    MLOpsDatabricks - Python output
    https://github.com/Azure-Samples/MLOpsDatabricks/blob/3f8a024b8b0b7b7f651a4e6c988c0df7167c7f6c/cluster_config/cluster_manager.py#L175
    https://github.com/Azure-Samples/MLOpsDatabricks/blob/3f8a024b8b0b7b7f651a4e6c988c0df7167c7f6c/azdo_pipelines/build-train.yml#L22

  2. algattik commented on Nov 27, 2019

    @algattik
    ContributorAuthor

    I've written a version that avoids setting environment variable and calling out an external bash process to write a file, and is therefore more idiomatic.

    It accepts a flag with the file name to write to.

    https://github.com/algattik/azure-mlops-terraform/blob/cff0076ca4d47897afbafd13e7282ff44c8580b1/devops_pipelines/azdo-ci-build-train.yml#L58

    https://github.com/algattik/azure-mlops-terraform/blob/cff0076ca4d47897afbafd13e7282ff44c8580b1/ml_pipelines/run_train_pipeline.py#L53

    Let me know if you agree with the approach and I'll submit a PR into MLOpsPython.

  3. dtzar commented on Nov 27, 2019

    @dtzar
    Contributor

    Sure that approach works, feel free to PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions