Drupal 10, the latest version of the open-source digital experience platform with even more features, is here.Since I'm using aegir on docker for development, I'm looking at the running hosting-queued output on a regular basis.
It's not informative at all unless you use the -v flag.
This patch moves the drush_log and watchdog calls to the `drush hosting-task` command, and outputs the title and node ID of the task.
Started hosting queue daemon. Waiting for new tasks. [ok]
Starting task "Reset password: [ok]
site.drupal.devshop.local.computer" [node/510]
Finished executing task "Reset password: [ok]
site.drupal.devshop.local.computer" [node/510].
| Comment | File | Size | Author |
|---|---|---|---|
| #35 | 2828630-hosting-queued-logs.patch | 409 bytes | Jon Pugh |
| #26 | 2828630-hosting-queued-logs.patch | 3.92 KB | Jon Pugh |











Comments
Comment #3
Jon PughComment #4
Jon PughComment #6
helmo CreditAttribution: helmo at Initfour websolutions commentednice...
One minor thing ...we could change 'Finished executing task' to 'Finished task'. Then start and finish messages are equal in length... and thus align.
Comment #8
Jon PughGreat idea. I also added the same messages to
drush hosting-taskscommand. This runs separately than thedrush hosting-queuedcommand.I tried putting these messages into the
drush hosting-taskcommand, but any logs there are saved into hostmaster. The point of this patch is to improve the output of the queue command.Branch pushed and new patch attached.
Comment #10
Jon PughComment #11
ergonlogicIn the interest of DRY, could we move this logging to common functions? Something like
hosting_task_log_start($task)andhosting_task_log_finish($task)?Comment #14
helmo CreditAttribution: helmo at Initfour websolutions commentedI added one commit to the feature branch to Make the log format more consistent ... trailing dots for all.
And moved this logging to common functions as #11suggested.
Comment #15
Jon PughI disagree with adding two new functions that will never be implemented again.
We already have too many functions like that in this project.
Most of the command
drush hosting-queuedis a copy ofdrush hosting-tasks.If you are interested in DRY, I would start there. the hosting-tasks command could just take an option to run as a daemon, couldn't it?
Comment #18
Jon PughNew commits:
Comment #20
helmo CreditAttribution: helmo at Initfour websolutions commentedI tested it again on my quickreview branch and found two problems. I squash merged it into https://github.com/aegir-project/hosting/pull/8 to keep the history readable.
1. Even though I had started the hosting queued without a verbose flag it started printing verbose things like 'Platforms path /var/aegir/platforms exists.' after merging this.
2. Duration is not set
Comment #22
Jon PughSorry about that, I committed this to the wrong branch and then never pushed!
Updated branch and patch makes $backend_options an argument so hosting-queued can use interactive and hosting-tasks can use fork.
Comment #23
helmo CreditAttribution: helmo at Initfour websolutions commentedThat's better on the verbosity :)
The '0 sec' is still there though... the frontend has 10 seconds recorded. If the value is just not available then we could just not show it.
Comment #25
Jon PughAh, my mistake, "duration" is a property devshop adds that is already formatted by format_interval().
Changed to "delta".
Comment #26
Jon PughComment #27
helmo CreditAttribution: helmo at Initfour websolutions commented:)
Comment #29
helmo CreditAttribution: helmo at Initfour websolutions commentedComment #31
Jon PughOne more change is needed...
drush @hostmaster hosting-tasksshould be able to be run in non-forked processes. This way we know the tasks are complete when the command ends.Comment #32
Jon PughThe reason is we turn off the queue for test runs. A behat step exists for running "drush hosting-tasks", which should not fork processes so we can skip the "and I wait 10 seconds" step.
Comment #34
Jon PughNew commits to the branch and patch attached.
All this patch does is allow for forking to be blocked by passing a '--fork=0' option.
This is really only for testing purposes. Blocking forking also prevents task logs from being saved in the front-end. But for running tests, we want the command to run and output to terminal, so this is really helpful. See the test result logs here: https://travis-ci.org/opendevshop/devshop/jobs/188910448#L2657
When I run drush "hosting-tasks --fork=0 --strict=0"
Then print last drush output
This is actually really important for good testing. We don't want the test to continue until the hosting-tasks run is complete. Right now we added a "Then I wait X seconds" step to mitigate this.
Comment #35
Jon PughComment #36
helmo CreditAttribution: helmo at Initfour websolutions commentedsounds good
Comment #38
helmo CreditAttribution: helmo at Initfour websolutions commented