-
Notifications
You must be signed in to change notification settings - Fork 439
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
Unify daemon processes #848
Conversation
@jdpedrie @dwsupplee This is not ready for a full review, but does abstracting the job interface make sense to you? It allows for configuring other asynchronous jobs besides batch jobs (with an item message queue). The primary use case for now is to handle the debugger's breakpoint fetching loop (which currently must be run as its own separate daemon). |
@chingor13, sounds like a great direction to move towards. 👍 |
@dwsupplee @jdpedrie @tmatsuo This should be ready for a look. |
$job->run($items); | ||
$this->assertEquals($expected, $this->items); | ||
} | ||
// public function testRun() |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
I tried this branch on GAE Flex. The code below
only spun up 2 child processes. Does it ring a bell? |
I had changed the parameter to |
That's definitely it. Perfonally I'm fine breaking this, but I'll defer to @dwsupplee for decision. The performance wise, the change has no problems at all. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a nicely thought out improvement. Great work.
numWorkers
sounds good to me. We have marked the batch feature as experimental everywhere so we have the leeway to make these kinds of improvements.
A few items:
- Should we have test coverage for the newly introduced Job related classes/traits?
- Will we need updates to accommodate for Introduce options to serialize closures for batch processing #886?
src/Core/Batch/JobConfig.php
Outdated
{ | ||
/** | ||
* @var BatchJob[] | ||
* @var array[string]JobInterface Associative array of JobInterface instances |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
src/Core/Batch/SimpleJob.php
Outdated
@@ -0,0 +1,86 @@ | |||
<?php | |||
/** | |||
* Copyright 2017 Google Inc. All Rights Reserved. |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
src/Debugger/Daemon.php
Outdated
@@ -207,6 +246,12 @@ private function defaultSourceContext() | |||
return []; | |||
} | |||
|
|||
|
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
src/Debugger/Daemon.php
Outdated
* to** a new DebuggerClient. | ||
* @type array $extSourceContext The source code identifier. **Defaults | ||
* @type string $sourceRoot The full path to the source root | ||
* @type array $clientOptions The options to instantiate the default |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
I'll add some more tests for the new job classes/traits and will update to use the closure serializer. |
Hold off on merging this. The system test is failing and I'm looking into it. |
@dwsupplee The system test is fixed. The actual problem was from #887 where I had made |
The BatchDaemon is great for submitting items in the background. We can abstract the concept of a job and leverage the job runner framework to support other job types - the primary example is supporting the Debugger daemon - a simple loop that uses long polling for results.
Currently, to use the debugger, you need to set up 2 daemon processes. By combining the daemons, the user only needs to set up a single daemon.
In this PR:
Example custom simple job: