| 1 | package App::Ordo::Command::Cluster::Run; | ||
| 2 | use Moo; | ||
| 3 | use feature qw(say); | ||
| 4 | extends 'App::Ordo::Command::Base'; | ||
| 5 | use Term::ANSIColor qw(colored); | ||
| 6 | |||
| 7 | use App::Ordo qw($CURRENT_PATH); | ||
| 8 | |||
| 9 | sub name { "cluster run" } | ||
| 10 | sub summary { "Run all jobs in a cluster (in dependency order)" } | ||
| 11 | sub usage { "<path>" } | ||
| 12 | |||
| 13 | sub option_spec { {} } | ||
| 14 | |||
| 15 | sub execute { | ||
| 16 | my ($self, $opt, $path) = @_; | ||
| 17 | |||
| 18 | #unless ($path) { | ||
| 19 | # say colored(["bold red"], "Usage: cluster run <path>"); | ||
| 20 | # return; | ||
| 21 | #} | ||
| 22 | |||
| 23 | my $res = $self->api->call('start_cluster', { name => $path }); | ||
| 24 | |||
| 25 | if ($res->{success}) { | ||
| 26 | say colored(["bold green"], "Cluster started"); | ||
| 27 | } else { | ||
| 28 | say colored(["bold red"], "Failed to start cluster: " . ($res->{message} || 'not found')); | ||
| 29 | } | ||
| 30 | } | ||
| 31 | |||
| 32 | 1; |