Tobias Macey
06/21/2021, 6:22 PMJosh Lloyd
06/21/2021, 9:09 PMdagster_shell.utils.execute
functionTobias Macey
06/21/2021, 11:33 PMJosh Lloyd
06/21/2021, 11:40 PM@solid(
input_defs=[
InputDefinition("start_after", Nothing),
InputDefinition("shell_command", str),
InputDefinition("env_dict", dict),
],
output_defs=[OutputDefinition(str, "result")],
)
def run_shell_command(context, shell_command, env_dict):
output, return_code = execute(
shell_command=shell_command,
log=context.log,
output_logging="STREAM",
env=env_dict,
cwd=os.getenv('DAGSTER_APP')
)
if return_code:
raise Failure(
description="Shell command execution failed with output: {output}".format(output=output)
)
return output
which is really just a stripped down version of dagster_shell.solids.shell_solid
in fact I had to from dagster_shell.utils import execute
just to get it to work
one other note: the reason why I went this route with my own custom solid rather than invoking dagster_shell
directly is because Meltano relies heavily on setting environment variables which can’t be passed into the native dagster_shell solids at run time. See this thread for a deeper explanation. https://dagster.slack.com/archives/C01U954MEER/p1623181007055200Tobias Macey
06/22/2021, 2:56 PMJosh Lloyd
06/22/2021, 2:59 PMTobias Macey
06/22/2021, 3:04 PMJosh Lloyd
06/22/2021, 3:06 PMmrdavidlaing
08/03/2021, 10:31 AMJosh Lloyd
08/03/2021, 2:27 PMTobias Macey
09/21/2021, 3:58 PMBinoy Shah
06/02/2022, 7:54 PMJosh Lloyd
06/07/2022, 4:39 PM