jieguangzhou opened a new issue, #58:
URL: https://github.com/apache/dolphinscheduler-sdk-python/issues/58

   ```python
   # [start workflow]
   from pydolphinscheduler.core import Workflow
   from pydolphinscheduler.core.resource import Resource
   from pydolphinscheduler.tasks import Shell
   
   dependence = "dependence.py"
   main = "main.py"
   
   with Workflow(
       name="multi_resources_example",
       # [start create_new_resources]
       resource_list=[
           Resource(
               name=dependence,
               content="from datetime import datetime\nnow = datetime.now()",
           ),
           Resource(name=main, content="from dependence import 
now\nprint(now)"),
       ],
       # [end create_new_resources]
   ) as workflow:
       # [start use_exists_resources]
       task_use_resource = Shell(
           name="use-resource",
           command=f"python {main}",
           resource_list=[
               dependence,
               main,
           ],
       )
       # [end use_exists_resources]
   
       workflow.run()
   # [end workflow]
   ```
   Change the above usage to the following usage
   ```python
   # [start workflow]
   from pydolphinscheduler.core import Workflow
   from pydolphinscheduler.core.resource import Resource, LocalResource
   from pydolphinscheduler.tasks import Shell
   
   dependence = "dependence.py"
   main = "main.py"
   
   with Workflow(
       name="multi_resources_example",
   ) as workflow:
       # [start use_exists_resources]
       task_use_resource = Shell(
           name="use-resource",
           command=f"python {main}",
           resource_list=[
               LocalResource('dependence.py'),
               LocalResource('main.py'),
               LocalResource('*.py'),
           ],
       )
       # [end use_exists_resources]
   
       workflow.run()
   # [end workflow]
   ```


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