Move Golem and Job from yapapi.executor.__init__ to yapapi.golem #431
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Separating
Golem
andExecutor
was not straightforward, since:Executor
creates an instance ofGolem
in its__init__()
methodGolem
creates an instance ofExecutor
in itsexecute_tasks()
methodFor this reason, the class
Golem
has been split into a mini-hierarchy:Engine
, including everythingGolem
included, except the high-level methodsrun_service()
andexecute_tasks()
Golem
, containing just the two methods mentioned aboveThe class
Engine
(together withJob
and some utility functions) is in moduleyapapi.engine
, whileGolem
is inyapapi.golem
.Executor
needs to import onlyyapapi.engine
, andGolem
may importyapapi.executor
without creatingcircular depdendencies.
All this was done rather quickly, there's probably much to be done, like adding the docstrings in
golem.py
and fixing the docstrings and comments elsewhere.Also, some modules should be removed from
yapapi.executor
package, as they contain code that is used byEngine
andGolem
rather than (or in addition to)Executor
, for exampleagreements_pool.py
.UPDATE: Further changes:
yapapi.engine.Engine
toyapapi.engine._Engine
, to indicate that it's not part of the public APImove-- this will be done in a separate PR, along with some other modules that currently reside instrategy.py
(a module withMarketStrategy
class, belonging to the public API) fromyapapi/executor/
toyapapi/
yapapi/executor/
but should not