-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature/python executor (early sight version) (#26)
* Ideas for an actor-based implementation of the executor * Notes on execution graph builder * Start sketching out ideas for V2 engine using actors * Add dependency on PyYAML for YAML config files * Utility methods for setting up loggers * Config parser for converting raw JSON/YAML into config classes * Add sys config classes (until these are generated from proto files) * Add node type for graph processing in engine V2 * Start sketching out a top level class for the runtime * Stubs for launch package * Test cases to run the Python examples from doc/ * Fixes for the HelloPandas example * Add run configs for Python runtime * V2 engine rough work * Flesh out ideas for the graph processor * Work on actors and V2 engine * Set minimum Python version to 3.7 in CI build * Minor fixes * Actors scaffolding to let a job begin * Fill in one basic test case for actors * Actor tidy ups, stop test from waiting until shutdown is built * ActorSystem shutdown sequence * Timeouts for basic build jobs (kill jobs if there are deadlocks exposed by the tests) * Consider stubs for actor system tests * Stubs for actor system tests * Remove old engine implementation notes * Rename V2 engine implementation module * Engine tweaks * Add some comments in engine.py * Sketch out more of the engine scaffolding * Skeleton from launch_model to node processor * Use a single storage key in hello_pandas sample config * Explicitly load module and launch model in trac_example test * Make all fields optional in generated domain classes (this is temporary, domain class generator to be updated to use dataclasses) * API naming changes in TracContext * Stub implementation of TracContext * Python runtime - engine updates * Add hello world example - model with just parameters, no inputs/outputs - for working through the skeleton framework * Handle optional types in config_parser * Engine framework loads model and enters run_model * Write model logs to the console * Pass job status back to the main engine actor * Shut down the engine after a batch run * Actor system - Failure processing for a single (root) actor * Actor system - message signature checking * Support new-style deferred type annotations in message signature checking * Make config parser work with deferred type annotations * Add unit tests for child actors and signals * Work on the actor system * Log colour highlighting * Actor updates * Actors fix: Stop sibling check * Actors: Fix duplicate child failure signals * Clean up engine shutdown sequence * Actors: Fix partial application of self * Actors: Implement error propagation * Make hello world model pick up parameters from job config * Fix and enable test for hello_pandas example * Initial work on the graph and graph builder * Execution graph updates * Update to NodeProcessor and NodeIds * Improve error propagation in the graph processor * Error propagation * Runtime data storage work * Data / storage definition updates * Python runtime code generator updates * Work on the storage implementation * Latest python runtime work * Generate dev mode input definitions * Fire the LoadDataFunc node in the engine * Hello Pandas model fixes * Pass input data through to main model API * Config parsing for dicts of mixed primitive values * Stricter config parsing for primitive values * Pandas outputs into local model context * Dev mode translation for job outputs * Start work on data save * Work on execution graph for outputs, use granular items and mappings * Set up local context for model execution by filtering the job's graph context to the model namespace * Use metadata to determine locations of outputs, prevent output overwriting * Create unique snaps for dev mode outputs on each run of the model (do not overwrite data) * Change example sys_config to work when run from the project root directory * Assign a job ID in dev mode * Tidy up ordering and logging for the execution graph * Rename runtime config -> system config for Python runtime * Update metadata service and tests to handle new storage definition object type in metadata * Run python example models as part of the basic build in CI * Config parser: Support Python 3.7 in handling of generic type info * Add explicit job dependency for models with no inputs/outputs * Use model class name in model node ID * Update readme for the Python model runtime
- Loading branch information
Martin Traverse
authored
Mar 3, 2021
1 parent
54b0f66
commit 2ef33e5
Showing
46 changed files
with
4,943 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
dev/ide/idea/runConfigurations/Python_Runtime__Codegen.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<component name="ProjectRunConfigurationManager"> | ||
<configuration default="false" name="Python Runtime: Codegen" type="PythonConfigurationType" factoryName="Python"> | ||
<module name="python-model-runtime" /> | ||
<option name="INTERPRETER_OPTIONS" value="" /> | ||
<option name="PARENT_ENVS" value="true" /> | ||
<envs> | ||
<env name="PYTHONUNBUFFERED" value="1" /> | ||
</envs> | ||
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/trac-runtime/python/codegen" /> | ||
<option name="IS_MODULE_SDK" value="true" /> | ||
<option name="ADD_CONTENT_ROOTS" value="false" /> | ||
<option name="ADD_SOURCE_ROOTS" value="true" /> | ||
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" /> | ||
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/trac-runtime/python/codegen/protoc-ctrl.py" /> | ||
<option name="PARAMETERS" value="--domain" /> | ||
<option name="SHOW_COMMAND_LINE" value="false" /> | ||
<option name="EMULATE_TERMINAL" value="false" /> | ||
<option name="MODULE_MODE" value="false" /> | ||
<option name="REDIRECT_INPUT" value="false" /> | ||
<option name="INPUT_FILE" value="" /> | ||
<method v="2" /> | ||
</configuration> | ||
</component> |
17 changes: 17 additions & 0 deletions
17
dev/ide/idea/runConfigurations/Python_Runtime__Examples.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<component name="ProjectRunConfigurationManager"> | ||
<configuration default="false" name="Python Runtime: Examples" type="tests" factoryName="Unittests"> | ||
<module name="python-model-runtime" /> | ||
<option name="INTERPRETER_OPTIONS" value="" /> | ||
<option name="PARENT_ENVS" value="true" /> | ||
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" /> | ||
<option name="IS_MODULE_SDK" value="true" /> | ||
<option name="ADD_CONTENT_ROOTS" value="false" /> | ||
<option name="ADD_SOURCE_ROOTS" value="true" /> | ||
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" /> | ||
<option name="_new_pattern" value="""" /> | ||
<option name="_new_additionalArguments" value=""discover -s trac-runtime/python/test/trac_examples -t trac-runtime/python/test"" /> | ||
<option name="_new_target" value="""" /> | ||
<option name="_new_targetType" value=""CUSTOM"" /> | ||
<method v="2" /> | ||
</configuration> | ||
</component> |
17 changes: 17 additions & 0 deletions
17
dev/ide/idea/runConfigurations/Python_Runtime__Unit_Tests.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<component name="ProjectRunConfigurationManager"> | ||
<configuration default="false" name="Python Runtime: Unit Tests" type="tests" factoryName="Unittests"> | ||
<module name="python-model-runtime" /> | ||
<option name="INTERPRETER_OPTIONS" value="" /> | ||
<option name="PARENT_ENVS" value="true" /> | ||
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" /> | ||
<option name="IS_MODULE_SDK" value="true" /> | ||
<option name="ADD_CONTENT_ROOTS" value="false" /> | ||
<option name="ADD_SOURCE_ROOTS" value="true" /> | ||
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" /> | ||
<option name="_new_pattern" value="""" /> | ||
<option name="_new_additionalArguments" value=""discover -s trac-runtime/python/test/trac_test -t trac-runtime/python/test"" /> | ||
<option name="_new_target" value="""" /> | ||
<option name="_new_targetType" value=""CUSTOM"" /> | ||
<method v="2" /> | ||
</configuration> | ||
</component> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# Copyright 2021 Accenture Global Solutions Limited | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
import typing as tp | ||
import trac.rt.api as trac | ||
|
||
|
||
class HelloWorldModel(trac.TracModel): | ||
|
||
def define_parameters(self) -> tp.Dict[str, trac.ModelParameter]: | ||
|
||
return trac.define_parameters( | ||
|
||
trac.P("meaning_of_life", trac.BasicType.INTEGER, | ||
label="The answer to the ultimate question of life, the universe and everything")) | ||
|
||
def define_inputs(self) -> tp.Dict[str, trac.TableDefinition]: | ||
|
||
return {} | ||
|
||
def define_outputs(self) -> tp.Dict[str, trac.TableDefinition]: | ||
|
||
return {} | ||
|
||
def run_model(self, ctx: trac.TracContext): | ||
|
||
ctx.log().info("Hello world model is running") | ||
|
||
meaning_of_life = ctx.get_parameter("meaning_of_life") | ||
ctx.log().info(f"The meaning of life is {meaning_of_life}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
|
||
parameters: | ||
meaning_of_life: 42 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,21 @@ | ||
|
||
storageSettings: | ||
defaultStorge: example_outputs | ||
defaultStorage: example_data | ||
defaultFormat: CSV | ||
|
||
storage: | ||
|
||
example_inputs: | ||
example_data: | ||
|
||
storageType: LOCAL_STORAGE | ||
storageConfig: | ||
rootPath: ./data/inputs | ||
|
||
example_outputs: | ||
|
||
storageType: LOCAL_STORAGE | ||
storageConfig: | ||
rootPath: ./data/outputs | ||
|
||
rootPath: doc/examples/models/python/data | ||
|
||
sparkSettings: | ||
|
||
sparkConfig: | ||
[spark.cores.max]: 4 | ||
[spark.driver.memory]: 2G | ||
[spark.executor.memory]: 2G | ||
[spark.default.parallelism]: 8 | ||
[spark.sql.shuffle.partitions]: 8 | ||
spark.cores.max: 4 | ||
spark.driver.memory: 2G | ||
spark.executor.memory: 2G | ||
spark.default.parallelism: 8 | ||
spark.sql.shuffle.partitions: 8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,6 +36,7 @@ enum ObjectType { | |
JOB = 4; | ||
FILE = 5; | ||
CUSTOM = 6; | ||
STORAGE = 7; | ||
} | ||
|
||
|
||
|
Oops, something went wrong.