Skip to content

Commit

Permalink
Merge pull request #54 from ghrcdaac/mlh0079-5311-dmrpp-option-issue
Browse files Browse the repository at this point in the history
 - Resolved issue with local file being used for -u option.
  • Loading branch information
NVD26 authored Sep 12, 2023
2 parents a758313 + 8915740 commit 5387989
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 117 deletions.
2 changes: 1 addition & 1 deletion dmrpp_generator/generate_and_validate_dmrpp.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def generate_docker_compose():
# Path to dockerfile.
# '.' represents the current directory in which
# docker-compose.yml is present.
image: ghrcdaac/dmrpp-generator:v3.4.0
image: ghrcdaac/dmrpp-generator:v4.1.1
environment:
- PAYLOAD=${PAYLOAD}
# Mount volume
Expand Down
8 changes: 6 additions & 2 deletions dmrpp_generator/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def get_dmrpp_command(self, dmrpp_meta, input_path, output_filename, local=False
dmrpp_meta = dmrpp_meta if isinstance(dmrpp_meta, dict) else {}
dmrpp_options = DMRppOptions(self.path)
options = dmrpp_options.get_dmrpp_option(dmrpp_meta=dmrpp_meta)
local_option = f"-u file://{output_filename}" if local else ""
local_option = f"-u file://{output_filename}" if '-u' in options else ''
dmrpp_cmd = f"get_dmrpp {options} {input_path} -o {output_filename}.dmrpp" \
f" {local_option} {os.path.basename(output_filename)}"
return " ".join(dmrpp_cmd.split())
Expand All @@ -174,7 +174,11 @@ def run_command(self, cmd):
stdout = subprocess.PIPE
stderr = subprocess.STDOUT

out = subprocess.run(cmd.split(), stdout=stdout, stderr=stderr, timeout=self.timeout, check=True)
try:
out = subprocess.run(cmd.split(), stdout=stdout, stderr=stderr, timeout=self.timeout, check=True)
except Exception as e:
self.logger_to_cw.info(f'cmd: {cmd}')
raise Exception(f'get_dmrpp failed. \ncmd: {cmd} \nException: {e}')

return out

Expand Down
114 changes: 0 additions & 114 deletions generate_and_validate_dmrpp

This file was deleted.

0 comments on commit 5387989

Please sign in to comment.