Skip to content

Support for Tasks functionality#112

Open
vitolkachova wants to merge 3 commits into
mainfrom
tasks-commands
Open

Support for Tasks functionality#112
vitolkachova wants to merge 3 commits into
mainfrom
tasks-commands

Conversation

@vitolkachova

Copy link
Copy Markdown
Contributor
  1. List available tasks
upsun task:list
  1. Run a task
upsun task:execute myagent --variable env:CALLER=me

use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;

#[AsCommand(name: 'task:execute', description: 'Execute a task on an environment')]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TBD - in Slack - we are discussing run instead of execute

// when several activities are running in parallel.
$activity = reset($activities);
$this->stdErr->writeln(sprintf(
'To follow its log, run: <info>%s activity:log %s</info>',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could directly follow the log here, using the ActivityMonitor service. I think it would be more consistent with other commands.

));

$url = $environment->getUri() . '/tasks/' . rawurlencode($taskName) . '/run';
$response = $this->api->getHttpClient()->request('POST', $url, ['json' => ['variables' => (object) $variables]]);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would benefit from the ApiResponseException wrapping (already used in TaskListCommand).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants