hardstuding opened a new issue, #162:
URL: https://github.com/apache/dolphinscheduler-sdk-python/issues/162
version:
python==3.11.11
apache-dolphinscheduler==4.0.4
dolphinscheduler=3.1.9
`from pydolphinscheduler.tasks.dependent import Dependent, DependentItem
di = DependentItem(
project_name='离线数仓',
workflow_name="离线数仓每日",
)
di.get_code_from_gateway()`
output: {'projectCode': 14395304812032, 'processDefinitionCode':
14395382583310}
So, I can sure the project and workflow is exist.
But when I use this wrokflow as a Dependent, the code show below. The
dependent can't be see in WEB UI
`from pydolphinscheduler.core.workflow import Workflow
# Import task Shell object cause we would create some shell tasks later
from pydolphinscheduler.tasks.shell import Shell
from pydolphinscheduler.tasks.dependent import Dependent, DependentItem
from pydolphinscheduler.tasks.python import Python
# [end package_import]
# [start workflow_declare]
with Workflow(
name="demo_pydolphinscheduler", # 任务流名称
schedule="0 0 5 * * ? *",
start_time="2025-04-18",
project='demo', # 项目
param={"dt": "$[yyyy-MM-dd-1]"}
) as workflow:
# [end workflow_declare]
# [start task_declare]
demo_dependent = Dependent(
name="demo_dependent",
dependence=DependentItem(
project_name='离线数仓',
workflow_name="离线数仓每日",
)
) # 有个bug,这个依赖在前端看不到
demo_bash = Shell(
name="demo_bash",
command="$EXECUTENOTEBOOK spark
$ALGOBASHPATH/big_data/demo/dolphinscheduler.ipynb --dt ${dt}",
worker_group='1150' # 这个任务指定的服务器
)
demo_python = Python(
name="demo_python",
definition="""import datetime
print(datetime.datetime.now())
dt = '${dt}'
local_param = '${local_param}'
print('schedule date:', dt)
print("local param:", local_param)""",
environment_name='spark',
worker_group='1150',
input_params={"local_param": "你好,我是节点变量"},
)
# [end task_declare]
# [start task_relation_declare]
demo_dependent >> demo_bash >> demo_python
# [end task_relation_declare]
# [start submit_or_run]
workflow.submit() # 仅提交
# workflow.run() # 提交并执行
# [end submit_or_run]
# [end tutorial]`

--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail:
[email protected]
For queries about this service, please contact Infrastructure at:
[email protected]