ShawshankLin commented on issue #10446:
URL: 
https://github.com/apache/dolphinscheduler/issues/10446#issuecomment-1200893306

   
![image](https://user-images.githubusercontent.com/16248686/182107729-3675087a-f887-4a22-9111-634390f28a0f.png)
   
![image](https://user-images.githubusercontent.com/16248686/182107754-0ff7f171-238f-43e7-8dd4-109cdbb86f7d.png)
   
![image](https://user-images.githubusercontent.com/16248686/182107780-a4cbb287-304d-48e2-a567-416d1c0aca97.png)
   cd '${file_path}'
    python -c "import 
test1;test1.get_task_instances('${project_code}','','','')" 
   
   test1.py
   
   import sys,os
   import requests
   sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
       
   # 查询任务实例
   def 
get_task_instances(project_code,process_Instance_Id="",task_name="",state_type=""):
       token = 'ac87b6898942649eca6008addb153ac4'
       addr = "127.0.0.1:12345"
       
process_instances_url='http://{addr}/dolphinscheduler/projects/{projectCode}/task-instances'
       headers = {
           "token": token,
           "accept": "application/json; charset=utf-8"
           }
       params={
           "projectCode":project_code, \
           "processInstanceId":process_Instance_Id, \
           "taskName":task_name,\
           "stateType":state_type,
           "pageNo":1, "pageSize":1000000}
       url = process_instances_url.format(addr=addr,projectCode=project_code)
       res= requests.get(url,params=params,headers=headers)
       result = res.json()
       print('任务实例get_task_instance_by_id',len(result))
       if result['code']==0 and result['data']:
           return result['data']['totalList']
       else:
           raise ValueError('查询工作流实例失败')
   
   
   # get_task_instances('6242391406976',"","","")
   
   
![image](https://user-images.githubusercontent.com/16248686/182107850-b1e5426e-1079-4568-ad07-ab47923d11e4.png)
   sleep 10
   echo '1111'
   
   
   


-- 
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]

Reply via email to