You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by GitBox <gi...@apache.org> on 2022/12/16 13:15:02 UTC

[GitHub] [dolphinscheduler-sdk-python] zhongjiajie commented on a diff in pull request #53: [improve] More pythonic way for parameter local_params in class task

zhongjiajie commented on code in PR #53:
URL: https://github.com/apache/dolphinscheduler-sdk-python/pull/53#discussion_r1050748534


##########
src/pydolphinscheduler/examples/parameter_example.py:
##########
@@ -0,0 +1,79 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+r"""
+A tutorial example take you to experience pydolphinscheduler.
+
+After tutorial.py file submit to Apache DolphinScheduler server a DAG would be create,
+and workflow DAG graph as below:
+
+                  --> task_child_one
+                /                    \
+task_parent -->                        -->  task_union
+                \                    /
+                  --> task_child_two
+
+it will instantiate and run all the task it have.
+"""
+
+# [start tutorial]
+# [start package_import]
+# Import Workflow object to define your workflow attributes
+from pydolphinscheduler.core.workflow import Workflow
+from pydolphinscheduler.core.parameter import ParameterType
+
+# Import task Shell object cause we would create some shell tasks later
+from pydolphinscheduler.tasks.shell import Shell
+from pprint import pprint
+
+# [end package_import]
+
+# [start workflow_declare]
+with Workflow(
+    name="tutorial",
+) as workflow:
+    task = Shell(name="task_parent",
+                 command="echo hello pydolphinscheduler",
+                 input_params={
+                     "value_VARCHAR": "abc",
+                     "value_LONG": ParameterType.LONG("1000000"),

Review Comment:
   such as long, list, date?



##########
src/pydolphinscheduler/examples/parameter_example.py:
##########
@@ -0,0 +1,79 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+r"""
+A tutorial example take you to experience pydolphinscheduler.
+
+After tutorial.py file submit to Apache DolphinScheduler server a DAG would be create,
+and workflow DAG graph as below:
+
+                  --> task_child_one
+                /                    \
+task_parent -->                        -->  task_union
+                \                    /
+                  --> task_child_two
+
+it will instantiate and run all the task it have.
+"""
+
+# [start tutorial]
+# [start package_import]
+# Import Workflow object to define your workflow attributes
+from pydolphinscheduler.core.workflow import Workflow
+from pydolphinscheduler.core.parameter import ParameterType
+
+# Import task Shell object cause we would create some shell tasks later
+from pydolphinscheduler.tasks.shell import Shell
+from pprint import pprint
+
+# [end package_import]
+
+# [start workflow_declare]
+with Workflow(
+    name="tutorial",
+) as workflow:
+    task = Shell(name="task_parent",
+                 command="echo hello pydolphinscheduler",
+                 input_params={
+                     "value_VARCHAR": "abc",
+                     "value_LONG": ParameterType.LONG("1000000"),

Review Comment:
   can we also find some way to auto-convert these parameter to java map?



-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org