-
-
Notifications
You must be signed in to change notification settings - Fork 5
Cancelling a workflow
Andrei Horak edited this page Mar 23, 2019
·
1 revision
There are cases when a workflow needs to exit before all tasks could have been
processed. In order to do so, return false
from any task. This will cause the
corresponding job to be given up and the workflow to stop running.
Cancelled workflows can be resumed, given the given up job has not been permanently removed yet.
class WatchGame < Pallets::Workflow
task TurnOnTv
task SwitchToSportsChannel => TurnOnTv
end
class TurnOnTv < Pallets::Task
def run
power = Power.status
# Cancel the workflow and do not run :switch_to_sports_channel anymore
return false if power == 'down'
end
end