Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Major shift to direct script execution instead of a helper binary.
Importing protos now hijacks control from the script and invokes an internal workflow manager. Removed the old helper program 'protos_agent.py' Added the internal workflow manager. It builds the workflow DAG and work queue, then executes all of the work items one by one. Changed configuration file options around so that config files are now no longer specified in protocol files. They should be taken from either the command line or an environment variable. Added a topological sort stub to core/workflow. This should return a serialization of all of the tasks in a workflow DAG. Added explicit documentation for configuration file options.
- Loading branch information
Showing
7 changed files
with
121 additions
and
29 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
This file was deleted.
Oops, something went wrong.
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,28 @@ | ||
# Agent | ||
# | ||
# The work manager, invoked when the first protos library import is called. | ||
# Instead of loading functions, the protos package __init__ function hijacks | ||
# control of the program and invokes this agent instead. The agent then | ||
# builds a complete workflow DAG from static analysis of the original file | ||
# and all of its specified dependencies (through protos.require()). Using | ||
# a topological sort of the DAG, the agent then executes all of the specied | ||
# scripts in order. | ||
|
||
import sys | ||
import workflow | ||
|
||
class Agent(): | ||
def __init__(self, root_protocol_file): | ||
self._flow = workflow.Workflow(root_protocol_file) | ||
self._workq = self._flow.toposort() | ||
self.run() # Does not return | ||
|
||
def run(self): | ||
assert self._flow is not None | ||
assert self._workq is not None | ||
|
||
for work_item in self._workq: | ||
print 'EXEC: ',work_item | ||
|
||
# All execution is complete. Do not return control to the user. Exit. | ||
sys.exit(0) |
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
# Protos user interface | ||
|
||
FUNCTIONS = [ 'config', 'require', 'log', 'var' ] | ||
FUNCTIONS = [ 'config', 'require', 'cache', 'log', 'var' ] |
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 @@ | ||
# Configuration File Options | ||
|
||
---- | ||
|
||
### Section: `project` | ||
Projects are a collection of related files to be scripted and controlled by a set of protos scripts. | ||
|
||
`project-type` | ||
> **values:** `files` `git` `svn`<br> | ||
> **default:** `'files'`<br> | ||
> Describes how the project is stored. If the type is `'git'` or `'svn'`, the project will be cloned or checked out if it doesn't already exist. | ||
`project-root'` | ||
> **values:** absolute path<br> | ||
> **default:** `''`<br> | ||
> The project root directory. Must be an absolute path. | ||
`protocol-path` | ||
> **values:** `:`-separated absolute or relative path prefix strings<br> | ||
> **default:** `''` <br> | ||
> Searched left-to-right. Relative paths are relative to `project-root`. Empty paths between `:`'s or at the beginning or end signify the project directory. | ||
`git-repo` | ||
> **values:** git repository location<br> | ||
> **default:** `''`<br> | ||
> If `project-type` is `git`, the location for the project's git repository. If `project-type` is anything else, the option is ignored. Should be something that git understands, which includes usernames embedded in ssh URLs and absolute pathnames. Relative pathnames are not a good idea. | ||
### Section: `log` | ||
|
||
Logs are a complete record of experimental results, archived somewhere permanent. | ||
|
||
`log-type` | ||
> **values:** `files` `git` `svn`<br> | ||
> **default:** `files` | ||
> Describes how the log is stored. If the type is `git` or `svn`, the project will be cloned or checked out if it doesn't already exist. | ||
`git-repo` | ||
> **values:** git repository location<br> | ||
> **default:** `''`<br> | ||
> If `log-type` is `git`, the location for the log's git repository. If `log-type` is anything else, the option is ignored. Should be something that git understands, which includes usernames embedded in ssh URLs and absolute pathnames. Relative pathnames are not a good idea. | ||