| 1 | package App::Ordo::Command::Job::Ice; | ||
| 2 | use Moo; | ||
| 3 | use feature qw(say); | ||
| 4 | extends 'App::Ordo::Command::Base'; | ||
| 5 | |||
| 6 | use Term::ANSIColor qw(colored); | ||
| 7 | |||
| 8 | sub name { "job ice" } | ||
| 9 | sub summary { "Skip job without blocking dependents" } | ||
| 10 | sub usage { "<path/name>" } | ||
| 11 | |||
| 12 | sub option_spec { {} } | ||
| 13 | |||
| 14 | sub execute { | ||
| 15 | my ($self, $opt, $name) = @_; | ||
| 16 | |||
| 17 | unless ($name) { | ||
| 18 | say colored(["bold red"], "Usage: job ice <path/name>"); | ||
| 19 | return; | ||
| 20 | } | ||
| 21 | |||
| 22 | my $res = $self->api->call('ice_job', { name => $name }); | ||
| 23 | |||
| 24 | if ($res->{success}) { | ||
| 25 | say colored(["bold cyan"], "Job '$name' iced"); | ||
| 26 | say colored(["bright_black"], "Downstream jobs will run as soon as upstream complete"); | ||
| 27 | } else { | ||
| 28 | say colored(["bold red"], "Failed to ice job: " . ($res->{message} || 'error')); | ||
| 29 | } | ||
| 30 | } | ||
| 31 | |||
| 32 | 1; |