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/11/15 08:33:11 UTC
[GitHub] [dolphinscheduler-sdk-python] zhongjiajie commented on a diff in pull request #15: [feat][task] Support Kubernetes task
zhongjiajie commented on code in PR #15:
URL: https://github.com/apache/dolphinscheduler-sdk-python/pull/15#discussion_r1022477921
##########
src/pydolphinscheduler/tasks/kubernetes.py:
##########
@@ -0,0 +1,60 @@
+# 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.
+
+"""Task Kubernetes."""
+from typing import Optional
+
+from pydolphinscheduler.constants import TaskType
+from pydolphinscheduler.core.task import Task
+
+
+class Kubernetes(Task):
+ """Task Kubernetes object, declare behavior for Kubernetes task to dolphinscheduler.
+
+ :param name: task name
+ :param image: the registry url for image.
+ :param namespace: the namespace for running k8s task.
+ :param min_cpu_cores: min CPU requirement for running k8s task.
+ :param min_memory_space: min memory requirement for running k8s task.
+ :param params_map: It is a local user-defined parameter for K8S task.
Review Comment:
It is better to use the whole name
```suggestion
:param namespace: the namespace for running Kubernetes task.
:param min_cpu_cores: min CPU requirement for running Kubernetes task.
:param min_memory_space: min memory requirement for running Kubernetes task.
:param params_map: It is a local user-defined parameter for Kubernetes task.
```
##########
src/pydolphinscheduler/tasks/kubernetes.py:
##########
@@ -0,0 +1,60 @@
+# 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.
+
+"""Task Kubernetes."""
+from typing import Optional
+
+from pydolphinscheduler.constants import TaskType
+from pydolphinscheduler.core.task import Task
+
+
+class Kubernetes(Task):
+ """Task Kubernetes object, declare behavior for Kubernetes task to dolphinscheduler.
+
+ :param name: task name
+ :param image: the registry url for image.
+ :param namespace: the namespace for running k8s task.
+ :param min_cpu_cores: min CPU requirement for running k8s task.
+ :param min_memory_space: min memory requirement for running k8s task.
+ :param params_map: It is a local user-defined parameter for K8S task.
+ """
+
+ _task_custom_attr = {
+ "image",
+ "namespace",
+ "min_cpu_cores",
+ "min_memory_space",
+ "params_map",
+ }
+
+ def __init__(
+ self,
+ name: str,
+ image: str,
+ namespace: str,
+ min_cpu_cores: float,
+ min_memory_space: float,
+ params_map: Optional[str] = str({}),
Review Comment:
I do not use the Kubernetes task, but doe parameter `params_map` same as `pydolphinscheduler.core.task.Task.local_params`?
##########
src/pydolphinscheduler/tasks/kubernetes.py:
##########
@@ -0,0 +1,60 @@
+# 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.
+
+"""Task Kubernetes."""
+from typing import Optional
+
+from pydolphinscheduler.constants import TaskType
+from pydolphinscheduler.core.task import Task
+
+
+class Kubernetes(Task):
+ """Task Kubernetes object, declare behavior for Kubernetes task to dolphinscheduler.
+
+ :param name: task name
+ :param image: the registry url for image.
+ :param namespace: the namespace for running k8s task.
+ :param min_cpu_cores: min CPU requirement for running k8s task.
+ :param min_memory_space: min memory requirement for running k8s task.
+ :param params_map: It is a local user-defined parameter for K8S task.
+ """
+
+ _task_custom_attr = {
+ "image",
+ "namespace",
+ "min_cpu_cores",
+ "min_memory_space",
+ "params_map",
+ }
+
+ def __init__(
+ self,
+ name: str,
+ image: str,
+ namespace: str,
+ min_cpu_cores: float,
+ min_memory_space: float,
Review Comment:
BTW, it is better to add that two parameter into mixin class or base class instead of task Kubernetes, But it is ok for currently
--
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