首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >以编程方式提交dagster (没有dagit graphQL)

以编程方式提交dagster (没有dagit graphQL)
EN

Stack Overflow用户
提问于 2022-05-09 14:39:31
回答 1查看 343关注 0票数 0

有没有一种方法,我可以提交达格斯特运行编程,而不使用达吉特graphQL?

代码语言:javascript
复制
    dagster_instance = DagsterInstance.get()
    dagster_instance.submit_run(
        pipeline_run.run_id,
        workspace=graphene_info.context
    )

基本上,我想使用上面的代码来提交一个新的运行,但我无法弄清楚如何获得pipeline_run和工作区。另外,我不打算使用Dagit GraphQL API。

如果还有其他方法,请提出建议。

感谢你的时间和帮助。

EN

回答 1

Stack Overflow用户

发布于 2022-05-19 07:59:51

Dagster Python还有一个实验性的GraphQL客户机,您可以使用它。

博士:https://docs.dagster.io/concepts/dagit/graphql-client

代码语言:javascript
复制
from dagster_graphql import DagsterGraphQLClient
from dagster_graphql import DagsterGraphQLClientError
from dagster import PipelineRunStatus

client = DagsterGraphQLClient("localhost", port_number=3000)

# submitting a job run
try:
    new_run_id: str = client.submit_job_execution(
        JOB_NAME,
        repository_location_name=REPO_LOCATION_NAME,
        repository_name=REPO_NAME,
        run_config={},
    )
    do_something_on_success(new_run_id)
except DagsterGraphQLClientError as exc:
    do_something_with_exc(exc)
    raise exc

# getting a job's run status
try:
    status: PipelineRunStatus = client.get_run_status(RUN_ID)
    if status == PipelineRunStatus.SUCCESS:
        do_something_on_success()
    else:
        do_something_else()
except DagsterGraphQLClientError as exc:
    do_something_with_exc(exc)
    raise exc
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/72173805

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档