https://dagster.io/ logo
Title
n

Navneet Sajwan

10/12/2021, 12:54 PM
Hi, I am using dagster-shell solid to create a python virtual environment and install packages into it . Is there a way, I can see the running log of the package installation?
s

sandy

10/12/2021, 11:01 PM
Hi Navneet - they're likely in the compute logs for the step. The compute logs are the raw stderr / stdout for the step process (as opposed to the Dagster logs, which are structured logs). To view them, if you're on the run page, there's a button right above the panel that shows the log entries, on the left side. Does that work for you?
a

Art

10/13/2021, 1:26 AM
@Navneet Sajwan I've been using
subprocess.Popen
to monitor stdout of a long-running external program (see below). It's pretty crufty though, is there a better way @sandy?
cmd = ["julia", "--project=.", line_coupling, branch_geo_file, input_dir, output_dir]
    p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)

    while True:
        line = p.stdout.readline()
        

        if line:
            <http://context.log.info|context.log.info>(line.decode("utf-8").rstrip())
        else:
            break
        
    for err in p.stderr.readlines():
        context.log.error(err.decode("utf-8").rstrip())
n

Navneet Sajwan

10/13/2021, 4:05 AM
Hi @sandy , I can some compute logs there. I don't understand why can't I see installation logs.
s

sandy

10/13/2021, 3:23 PM
one thing to try: shell solids/ops accept an "output_logging" config option. here's what it accepts:
"output_logging": Field(
            Enum(
                name="OutputType",
                enum_values=[
                    EnumValue("STREAM", description="Stream script stdout/stderr."),
                    EnumValue(
                        "BUFFER",
                        description="Buffer shell script stdout/stderr, then log upon completion.",
                    ),
                    EnumValue("NONE", description="No logging"),
                ],
            ),
            is_required=False,
            default_value="BUFFER",
        ),
you could do
my_shell_solid_with_stream_logging = my_shell_solid.configured({"output_logging": "STREAM"})
n

Navneet Sajwan

11/02/2021, 5:29 PM
hi @sandy, where do i add this part,
"output_logging": Field(
            Enum(
                name="OutputType",
                enum_values=[
                    EnumValue("STREAM", description="Stream script stdout/stderr."),
                    EnumValue(
                        "BUFFER",
                        description="Buffer shell script stdout/stderr, then log upon completion.",
                    ),
                    EnumValue("NONE", description="No logging"),
                ],
            ),
            is_required=False,
            default_value="BUFFER",
        ),
s

sandy

11/02/2021, 5:53 PM
you don't need to add that snippet anywhere - I just included that for documentation. you would add:
my_shell_solid_with_stream_logging = my_shell_solid.configured({"output_logging": "STREAM"})
n

Navneet Sajwan

11/02/2021, 7:05 PM
Thanks @sandy, it works with a little modification. Need to pass the name parameter:
my_shell_solid_with_stream_logging = my_shell_solid.configured({"output_logging": "STREAM"}, name="solid_name")