jasono
04/04/2022, 12:39 AMclaire
04/04/2022, 5:01 PMget_context
object that should be what you're looking for:
https://docs.dagster.io/_apidocs/libraries/dagstermill#dagstermill.get_context
You can specify base_dir
through the run config
import dagstermill as dm
from dagster import ModeDefinition, local_file_manager
context = dm.get_context(
mode_def=ModeDefinition(resource_defs={"file_manager": local_file_manager}),
run_config={"resources": {"file_manager": {"config": {"base_dir": ...}}}},
)
jasono
04/04/2022, 10:34 PMcontext
in the wrong place?Dagster.check.ParameterCheckError: Param "init_context" is not a InitResourceContext. Got <dagstermill.context.DagstermillExecutionContext object at 0x00000013E96B7D90> which is type <class 'dagstermill.context.DagstermillExecutionContext'>.
context1 = dm.get_context(
mode_def = ModeDefinition(
resource_defs = {
"file_manager": local_file_manager}
),
run_config={
"resources": {"file_manager":
{"config": {"base_dir":"t:/data/output/me_recon/recon_8510R" }}
}
}
)
notebook_op_8510R = dm.define_dagstermill_op(
"recon_8510R",
script_relative_path("datapipeline/me_recon_supports/recon_8510R.ipynb"),
output_notebook_name="recon_8510R_output",
config_schema={
"text1": Field(
Int,
default_value=777,
is_required=False,
description="The number of clusters to find",
)},
)
@job(
resource_defs={
"output_notebook_io_manager": dm.local_output_notebook_io_manager(context1)
}
)
def run_8510R():
notebook_op_8510R()
claire
04/04/2022, 11:09 PMoutput_notebook_io_manager
, you can just provide run config to the job directly without creating a context object:
@job(
resource_defs={
"output_notebook_io_manager": dm.local_output_notebook_io_manager
},
config={
"resources": {"output_notebook_io_manager":
{"config": {"base_dir":"t:/data/output/me_recon/recon_8510R" }}
}
}
)
def run_8510R():
notebook_op_8510R()
jasono
04/04/2022, 11:16 PMclaire
04/04/2022, 11:50 PM