Skip to content

Commit

Permalink
Explicit path to nwp-consumer executable
Browse files Browse the repository at this point in the history
  • Loading branch information
devsjc committed Sep 15, 2023
1 parent b687fcf commit 3d878ea
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions nwp/assets/ecmwf/mars.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import os
import subprocess
from dagster import Config, OpExecutionContext, op, graph
import sys

from dagster import Config, OpExecutionContext, op
from dagster_docker import execute_docker_container


Expand Down Expand Up @@ -33,27 +36,25 @@ def nwp_consumer_docker_op(context: OpExecutionContext, config: NWPConsumerConfi
@op
def nwp_consumer_download_op(context: OpExecutionContext, config: NWPConsumerConfig):
process = subprocess.run(
["nwp-consumer", "download",
[f"{os.path.dirname(sys.executable)}/nwp-consumer", "download",
f'--source={config.source}', f'--from={config.date_from}', f'--to={config.date_to}',
f'--rdir={config.raw_dir}', f'--zdir={config.zarr_dir}'],
stdout = subprocess.PIPE,
stderr = subprocess.PIPE,
capture_output=True,
text=True
)
code = process.returncode
print(process.stdout)
print(process.stderr)
process.check_returncode()
return config

@op
def nwp_consumer_convert_op(context: OpExecutionContext, downloadedConfig: NWPConsumerConfig):
process = subprocess.run(
["nwp-consumer", "convert",
[f"{os.path.dirname(sys.executable)}/nwp-consumer", "convert",
f'--source={downloadedConfig.source}', f'--from={downloadedConfig.date_from}',
f'--to={downloadedConfig.date_to}',
f'--rdir={downloadedConfig.raw_dir}', f'--zdir={downloadedConfig.zarr_dir}'],
stdout = subprocess.PIPE,
stderr = subprocess.PIPE,
capture_output=True,
text=True
)
print(process.stdout)
Expand Down

0 comments on commit 3d878ea

Please sign in to comment.