-
Notifications
You must be signed in to change notification settings - Fork 27
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
Feature: Test Orchestrator (astrolabe) #2
Feature: Test Orchestrator (astrolabe) #2
Conversation
1b5f6c8
to
b68df26
Compare
This comment has been minimized.
This comment has been minimized.
f6c46ab
to
de9bece
Compare
bd270c9
to
aefe8b6
Compare
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.
Quick review. I think it would be a good idea to add logging (via stdlib logging) to the cli methods that will be used in evergreen.
setup.py
Outdated
@@ -40,6 +40,7 @@ | |||
'pymongo>=3.10,<4', | |||
'dnspython>=1.16,<2', | |||
'pyyaml>=5,<6', | |||
'tabulate>=0.8,<0.9', |
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.
What feature does this library provide? Do we need it?
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.
It provides a quick way to convert a list of lists into a textual table of various styles. In our case, we want the rst format to be able to include the resulting table into docs. While the docs part is not yet done, take a look at the docgen.py
file for a closer look.
To see it in action install the package and do astrolabe info environment-variables
or astrolabe info default-values
.
Sorry for the epic code churn in that last commit @ShaneHarvey. The next time you take a look, things should be a lot easier to understand. |
021687c
to
7cb5d82
Compare
astrolabe/spec_runner.py
Outdated
driver_workload = json.dumps(self.spec.driverWorkload) | ||
worker_subprocess = subprocess.Popen([ | ||
sys.executable, self.config.workload_executor, connection_string, | ||
driver_workload], stdout=subprocess.PIPE, stderr=subprocess.PIPE) |
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.
Since we PIPE the output, we need to continuously read the worker_subprocess output (via worker_subprocess.stdout.read(..)
) or else we risk blocking the child process when the pipe fills up.
See the note in subprocess.wait:
This will deadlock when using stdout=PIPE or stderr=PIPE and the child process generates enough output to a pipe such that it blocks waiting for the OS pipe buffer to accept more data. Use Popen.communicate() when using pipes to avoid that.
https://docs.python.org/3/library/subprocess.html#subprocess.Popen.wait
A simpler option might be to redirect the worker_subprocess output to a file. Then we can open and read the file after the process exits.
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.
Just to be clear: there's no risk of deadlock in the current approach. The risk is that the child process can fill up the pipe with output and then it will block until we call worker_subprocess.communicate() down below.
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.
Great point. I have opened #9 for this.
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.
LGTM, with two small nits
astrolabe/cli.py
Outdated
help='Salt for generating unique hashes.') | ||
|
||
XUNITOUTPUT_OPTION = click.option( | ||
'--xunit-output', type=click.STRING, default="xunit-output", |
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.
why are some of these OPTNAMES.XXX
and others inline strings?
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.
The ones which can be displayed/tabulated using astrolabe info <...>
are the ones that are specified using a OPTNAMES.XXX
. Options with inline strings are not tabulated in the same manner and are not required to be (in my estimation).
astrolabe/spec_runner.py
Outdated
coll = client.get_database( | ||
self.spec.driverWorkload.database).get_collection( | ||
self.spec.driverWorkload.collection) | ||
coll.drop() |
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.
do you need to potentially catch ns not found
? or is that not a problem for python?
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.
PyMongo ignores this error on drop()
so no special handling is required.
astrolabe/spec_runner.py
Outdated
cluster_config = final_config.clusterConfiguration | ||
process_args = final_config.processArgs | ||
|
||
if not cluster_config and not process_args: |
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.
should we consider doing validation much earlier, so you can bail before any I/O if need be?
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.
Good point. In general, we just need a lot more validation of the test specification. I have opened #10 to do this.
f50b38e
to
f9d738f
Compare
Still needs:
mongod/mongos log retrieval functionality (wait until Atlas logs are current for driver ops; download them in a folder hierarchy that makes it easy to find the logs corresponding to a specific test; zip this file for upload to S3 after EVG run)(moved to follow-on work, see Add post test log retrieval functionality #4)logging
module (this includes INFO level logs instead of the current print statements that make it easier to follow the progress of a test run)