-
Notifications
You must be signed in to change notification settings - Fork 23
WIP: Added json conversion of NWChem to workflow #557
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
base: master
Are you sure you want to change the base?
Changes from 1 commit
cf24e7c
70e29e3
dc65096
1d35945
23df0c4
e8a050c
0407b9e
c57d0ab
a7bd2df
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| backports.tempfile==1.0rc1 | ||
| jsonschema==2.4.0 | ||
| jsonpath-rw==1.4.0 | ||
| jsonpath-rw-ext==1.0.0 | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,11 +16,11 @@ | |
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
| ############################################################################### | ||
| import tempfile | ||
| import json | ||
| import os | ||
| import subprocess | ||
| import shutil | ||
| from backports.tempfile import TemporaryDirectory | ||
| from jsonpath_rw import parse | ||
| from celery.exceptions import Retry | ||
|
|
||
|
|
@@ -226,9 +226,8 @@ def create_json_output(task, upstream_result): | |
| job_dir = job_directory(cluster, job) | ||
| out_file = '%s.out' % (job['name']) | ||
|
|
||
| try: | ||
| with TemporaryDirectory() as tmp_dir: | ||
| # Copy the nwchem output to server | ||
| tmp_dir = tempfile.mkdtemp() | ||
| cluster_path = os.path.join(job_dir, out_file) | ||
| local_path = os.path.join(tmp_dir, out_file) | ||
| with open(local_path, 'w') as local_fp: | ||
|
|
@@ -244,9 +243,10 @@ def create_json_output(task, upstream_result): | |
| stdout, stderr = p.communicate() | ||
|
|
||
| if p.returncode != 0: | ||
| print('Error running Docker container.') | ||
| print('STDOUT: ' + stdout) | ||
| print('STDERR: ' + stderr) | ||
| task | ||
| task.logger.error('Error running Docker container.') | ||
| task.logger.error('STDOUT: ' + stdout) | ||
| task.logger.error('STDERR: ' + stderr) | ||
| raise Exception('Docker returned code {}.'.format(p.returncode)) | ||
|
|
||
| # Copy json file back to cluster? | ||
|
|
@@ -256,11 +256,6 @@ def create_json_output(task, upstream_result): | |
| with open(local_path, 'r') as local_fp: | ||
| conn.put(local_fp, cluster_path) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We don't need the JSON back on the cluster, it should just be uploaded to Girder There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @chetnieter We should factor out the docker run code into a set of function that can be reused by other taskflows. |
||
|
|
||
| # Delete temporary storage | ||
| finally: | ||
| if os.path.exists(tmp_dir): | ||
| shutil.rmtree(tmp_dir) | ||
|
|
||
| return upstream_result | ||
|
|
||
| @cumulus.taskflow.task | ||
|
|
||
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.
Look like this is a typo?