Hi Guys, I'm just going through documentation and ...
# dagster-feedback
j
Hi Guys, I'm just going through documentation and in https://docs.dagster.io/concepts/ops-jobs-graphs/op-hooks#patterns It seems that notif_all_prod and notif_all_dev should be switched. Am I correct or I don't get the point?
In this case, we can mock the
slack_resource
using a helper function
ResourceDefinition.hardcoded_resource()
, so it won't send slack messages during development.
Copy code
@graph
def slack_notif_all():
    a()
    b()


notif_all_prod = slack_notif_all.to_job(
    name="notif_all_prod",
    resource_defs={
        "slack": ResourceDefinition.hardcoded_resource(
            slack_resource_mock, "do not send messages in dev"
        )
    },
    hooks={slack_message_on_failure},
)

notif_all_dev = slack_notif_all.to_job(
    name="notif_all_dev",
    resource_defs={"slack": slack_resource},
    hooks={slack_message_on_failure},
)
But for me it seems that it's doing opposite
r
yeah, your understanding is correct. it’s an oversight in the docs, thanks for the report. https://github.com/dagster-io/dagster/pull/8403 should fix
👍 1
❤️ 1
j
and here:
Copy code
if __name__ == "__main__":
    with open(
        file_relative_path(__file__, "prod_op_hooks.yaml"),
        "r",
        encoding="utf8",
    ) as fd:
        run_config = yaml.safe_load(fd.read())
    result = notif_all_dev.execute_in_process(
        run_config=run_config, raise_on_error=False
    )
shouldn't be notif_all_prod instead of notif_all_dev after your changes?
👍🏽 1