Kevin Haynes
01/28/2022, 9:39 PMDagsterInvalidConfigError
because the slack
resource key is not defined. The only difference between my computer and the github action is the OS and the python version (I'm on 3.9.8 but the runner is 3.9.10). The same error is thrown while building the op context for the unit test written for the op itself.
Another thing I noticed is that the S3 example (first link) uses the sensor context's last_run_key
, but I notice the docs indicate that this is deprecated.
Any ideas what might be going wrong or suggestions for how I can fix this?
I'm attaching the console output for the failure in GitHub, the py file for the op/job/sensor as well as the one for the unit tests.prha
01/28/2022, 10:28 PMlast_run_key
, we recommend using the context.cursor
instead (it’s more generic). The resulting snippet would look like this:
@sensor(job=my_job)
def my_s3_sensor(context):
new_s3_keys = get_s3_keys("my_s3_bucket", since_key=context.cursor)
if not new_s3_keys:
yield SkipReason("No new s3 files found for bucket my_s3_bucket.")
return
for s3_key in new_s3_keys:
yield RunRequest(run_key=s3_key, run_config={})
context.update_cursor(s3_key)
Kevin Haynes
01/28/2022, 10:35 PMtest_s3_sensor
) but I'm still getting the same error on the other test for the op (test_log_file
). Am I building the op context incorrectly, by chance?prha
01/28/2022, 11:07 PMlyn_slack_resource
?lyn_slack_resource
requires config, you either have to provide it in your build_op_context
call (using configured
), or provide it in the run_config (from the sensor’s RunRequest
)Kevin Haynes
01/31/2022, 4:15 PMlyn_slack_resource
@configured(slack_resource)
def lyn_slack_resource(_):
return {"token": os.getenv("SLACK_TOKEN")}
The env variable is set in the actions using a github secret, so it doesn't require any config.prha
01/31/2022, 4:54 PMtoken
in the config…. can you try:
@configured(slack_resource)
def lyn_slack_resource(_):
return {"token": {"env": "SLACK_TOKEN"}}
Wondering if there’s a difference in the actual execution time environment and the definition time environment…Kevin Haynes
01/31/2022, 5:02 PMprha
01/31/2022, 5:05 PM