-
Notifications
You must be signed in to change notification settings - Fork 304
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to suppress printing execution time using $this->taskExec() ? #383
Comments
Robo prints success/error results, including execution time, from the constructor of the Result object. This gives clients no opportunity to suppress this output. Ideally, this would be refactored in a future version of Robo. In the 1.x timeframe, the best we could do would be to provide some sort of static variable to disable the result output. I'm not sure if that would be worth the overhead. Could you provide more details on your use case? e.g. What would your desired output (including your custom time counter output) look like? |
Ok, here's my case: class RoboFile extends \Robo\Tasks
{
public function exportFromMySql()
{
$taskStartTime = time();
$sql = 'select * from bigtable;';
$output = '~/output/out.csv';
$this->taskExec('mysql')
->arg('testdb')
->arg('--host=localhost')
->arg('--port=1234')
->arg('--user=test')
->arg('--password=test')
->arg('--quick')
->arg(' -c "' . $sql . '" > ' . $output)
->printed(true)
->run()
->stopOnFail();
//it prints execution time like
//Done for 05:10:45
$this->say('Done for ' . Util::getFormattedExecutionTime($taskStartTime, time()));
//and after this robo prints it's own execution time output, which is already unnecessary for me
}
public function importToMongoDb(){
//similar task
}
} It will be very handy to have opprotunity to change behaviour of Result output, i.e disable it, format it, whatever. |
I think that will be enough for me. |
Static variable is fine. It should disable both the starting and ending output. |
I refactored the Config class to make it easier to reference from other classes (Config no longer contains a reference to the Container). TaskIO now checks Config::isSuppressed() before doing output. Things emitted by Some things I realized in working on that PR:
As far as this feature request is concerned, I think it would be better to submit a PR to robo to change the formatting of the execution time universally rather than try to turn off the default output and supply your own preferred time formatter. |
@DavertMik: Please confirm this is not supported & close. Folks can turn off all task output via --supress-messages; otherwise, they cannot control how Robo does progress output unless they make their own standalone application. |
This can be controlled if you use Robo as a framework to create your own application; see framework.md. Other use-cases not supported. |
How to suppress printing execution time using
$this->taskExec()
? I have my own implemented execution time counter and i want to use it, not robo's version. Are there any opportunities to achieve that?I am using 1.0.0beta1 robo's version.
The text was updated successfully, but these errors were encountered: