cylc-flow icon indicating copy to clipboard operation
cylc-flow copied to clipboard

Subshell platform selection appears to only work for the first task of each name

Open wxtim opened this issue 6 months ago • 0 comments

Description

Where a config set a platform using a subshell it doesn't appear to be able to change the platform dynamically: The platform selected for the first instance of the task seems to stick.

Reproducible Example

The following workflow should demonstrate flip-flop platform selection, but doesn't.

[scheduling]
    cycling mode = integer
    [[graph]]
        P1 = remote_task[-P1] => toggler => remote_task

[runtime]
    [[remote_task]]
        platform = $(cat ${HOME}/pretend-hall-info)

    [[toggler]]
        script = """
            HPC1=address
            HPC2=address

            # Create pretend-hall-info file if it does not exist
            if [[ ! -f ${HOME}/pretend-hall-info ]]; then
                echo ${HPC1} > ${HOME}/pretend-hall-info
            fi

            # Read the current platform from the file and toggle it
            this=$(cat ${HOME}/pretend-hall-info)
            echo $this
            if [[ $this == "${HPC1}" ]]; then
                echo ${HPC2} > ${HOME}/pretend-hall-info
                cylc message -- "WARNING:changing platform to ${HPC2}"
            else
                echo "${HPC1}" > ${HOME}/pretend-hall-info
                cylc message -- "WARNING:changing platform to '${HPC1}'"
            fi
        """

wxtim avatar Jun 23 '25 15:06 wxtim