Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions requirements.txt
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
Expand Down
File renamed without changes.
17 changes: 6 additions & 11 deletions server/taskflows/hpccloud/taskflow/nwchem/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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:
Expand All @@ -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
Copy link
Copy Markdown

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?

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?
Expand All @@ -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)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The 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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The 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
Expand Down