Vlad Efanov
01/26/2022, 4:08 PMdaniel
01/26/2022, 4:11 PMVlad Efanov
01/26/2022, 4:21 PMdagster-daemon run
I get
c:\users\vladi\appdata\local\programs\python\python38\lib\site-packages\dagster\core\instance\config.py:31: UserWarning: No dagster instance configuration file (dagster.yaml) found at D:\Python_Projects\DAGSTER\project. Defaulting to loading and storing all metadata with D:\Python_Projects\DAGSTER\project. If this is the desired behavior, create an empty dagster.yaml file in D:\Python_Projects\DAGSTER\project.
warnings.warn(
I didn't find any dagster.yaml example. What should this file include?daniel
01/27/2022, 3:58 PMVlad Efanov
01/29/2022, 12:11 PMdagster new-project test_project
cd test_project
pip install --editable .
dagit
2. Created an empty file D:\Python_Projects\DAGSTER\test_project\dagster.yaml
4. Created an empty file D:\Python_Projects\DAGSTER\test_project\logs\event.log
4. In another terminal ran dagster-daemon
$env:DAGSTER_HOME = "D:\Python_Projects\DAGSTER\test_project"
dagster-daemon run
There is my code:
Op file print_path.py:
from dagster import op
@op(config_schema={"filepath": str})
def print_path(context):
filepath = context.op_config["filepath"]
print(filepath)
Job file run_print_path.py:
from dagster import job
from test_project.ops.print_path import print_path
@job
def run_print_path():
print("Job started")
print_path()
Sensor file print_sensor.py:
import os
from dagster import sensor, RunRequest
from test_project.jobs.run_print_path import run_print_path
MY_DIRECTORY = r'D:\Python_Projects\DAGSTER\python_project\my_folder'
@sensor(job=run_print_path)
def print_sensor(_context):
for filename in os.listdir(MY_DIRECTORY):
filepath = os.path.join(MY_DIRECTORY, filename)
if os.path.isfile(filepath):
yield RunRequest(
run_key=filename,
run_config={"ops": {"process_file": {"config": {"filepath": filepath}}}},
)
Repository file repository.py:
from dagster import repository
from test_project.jobs.run_print_path import run_print_path
from test_project.sensors.print_sensor import print_sensor
@repository
def test_project():
jobs = [run_print_path]
sensors = [print_sensor]
return jobs + sensors
In browser I see that:daniel
01/29/2022, 12:46 PMVlad Efanov
01/29/2022, 12:49 PMdagit
and dagster-daemon run
in the same folder D:\Python_Projects\DAGSTER\test_projectdaniel
01/29/2022, 1:00 PMVlad Efanov
01/29/2022, 1:12 PM$env:DAGSTER_HOME = "D:\Python_Projects\DAGSTER\test_project"
before I run dagit
?daniel
01/29/2022, 1:27 PMVlad Efanov
01/29/2022, 2:20 PM2022-01-29 16:18:27 +0200 - dagster.daemon.SensorDaemon - ERROR - Sensor daemon caught an error for sensor print_sensor : dagster.core.errors.DagsterInvalidConfigError: Error in config for job
Error 1: Received unexpected config entry "process_file" at path root:ops. Expected: "{ print_path: { config: { filepath: String } outputs?: [{ result?: { json: { path: String } pickle: { path: String } } }] } }".
Error 2: Missing required config entry "print_path" at path root:ops. Sample config for missing entry: {'print_path': {'config': {'filepath': '...'}}}
Stack Trace:
File "c:\users\vladi\appdata\local\programs\python\python38\lib\site-packages\dagster\grpc\impl.py", line 354, in get_external_execution_plan_snapshot
create_execution_plan(
File "c:\users\vladi\appdata\local\programs\python\python38\lib\site-packages\dagster\core\execution\api.py", line 743, in create_execution_plan
resolved_run_config = ResolvedRunConfig.build(pipeline_def, run_config, mode=mode)
File "c:\users\vladi\appdata\local\programs\python\python38\lib\site-packages\dagster\core\system_config\objects.py", line 159, in build
raise DagsterInvalidConfigError(
daniel
01/29/2022, 2:28 PMVlad Efanov
01/29/2022, 2:37 PM