[meta]
    title = "Try out scenarios for intelligent host selection."
    description = """
        Tasks
        - goodhost: a control to check that everything works
        - badhost is always going to fail
        - mixedhost contains some hosts that will and won't fail
    """

[scheduler]
    [[events]]
        expected task failures = 1/goodhosttask, 1/mixedhosttask


[scheduling]
    cycling mode = integer
    initial cycle point = 1
    [[graph]]
        # Run good and mixed as controls
        R1 = """
            goodhosttask & mixedhosttask
            goodhosttask:start => stop_g
            mixedhosttask:start => stop_m
        """

[runtime]
    [[root]]
        script = sleep 120 & echo $! >file; wait

    [[mystop]]
        script="""
            sleep 5  # Give the badhosts list time to empty
            cylc kill "$CYLC_WORKFLOW_ID//$TASK"
            cylc stop $CYLC_WORKFLOW_ID
        """

    [[goodhosttask]]
        platform = goodhostplatform

    [[mixedhosttask]]
        script=sleep 120 & echo $! >file; wait

        platform = mixedhostplatform

    [[stop_g]]
        inherit = mystop
        [[[environment]]]
            TASK = 1/goodhosttask

    [[stop_m]]
        inherit = mystop
        [[[environment]]]
            TASK = 1/mixedhosttask
