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/10/22 01:08:47 UTC

[GitHub] [dolphinscheduler] ruanwenjun commented on a diff in pull request #12474: [Refactor] Migrate all command-related interface functions from ProcessServiceImpl

ruanwenjun commented on code in PR #12474:
URL: https://github.com/apache/dolphinscheduler/pull/12474#discussion_r1002292254


##########
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/command/CommandService.java:
##########
@@ -0,0 +1,104 @@
+/*
+ * 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.
+ */
+
+package org.apache.dolphinscheduler.service.command;
+
+import org.apache.dolphinscheduler.dao.entity.Command;
+import org.apache.dolphinscheduler.dao.entity.ProcessInstance;
+import org.apache.dolphinscheduler.dao.entity.ProcessInstanceMap;
+import org.apache.dolphinscheduler.dao.entity.TaskInstance;
+
+import java.util.List;
+
+/**
+ * Command Service
+ */
+public interface CommandService {
+
+    /**
+     * Save error command, and delete original command. If the given command has already been moved into error command,
+     * will throw {@link java.sql.SQLIntegrityConstraintViolationException ).
+     * @param command command
+     * @param message message
+     */
+    void moveToErrorCommand(Command command, String message);
+
+    /**
+     * Create new command
+     * @param command command
+     * @return result
+     */
+    int createCommand(Command command);

Review Comment:
   This method make confusion with `saveCommand`, we would better don't keep both.



##########
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/command/CommandService.java:
##########
@@ -0,0 +1,104 @@
+/*
+ * 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.
+ */
+
+package org.apache.dolphinscheduler.service.command;
+
+import org.apache.dolphinscheduler.dao.entity.Command;
+import org.apache.dolphinscheduler.dao.entity.ProcessInstance;
+import org.apache.dolphinscheduler.dao.entity.ProcessInstanceMap;
+import org.apache.dolphinscheduler.dao.entity.TaskInstance;
+
+import java.util.List;
+
+/**
+ * Command Service
+ */
+public interface CommandService {
+
+    /**
+     * Save error command, and delete original command. If the given command has already been moved into error command,
+     * will throw {@link java.sql.SQLIntegrityConstraintViolationException ).
+     * @param command command
+     * @param message message
+     */
+    void moveToErrorCommand(Command command, String message);
+
+    /**
+     * Create new command
+     * @param command command
+     * @return result
+     */
+    int createCommand(Command command);
+
+    /**
+     * Get command page
+     * @param pageSize page size
+     * @param pageNumber page number
+     * @return command page
+     */
+    List<Command> findCommandPage(int pageSize, int pageNumber);
+
+    /**
+     * Get command page
+     * @param pageSize page size
+     * @param pageNumber page number
+     * @param masterCount master count
+     * @param thisMasterSlot master slot
+     * @return command page
+     */
+    List<Command> findCommandPageBySlot(int pageSize, int pageNumber, int masterCount, int thisMasterSlot);
+
+    /**
+     * check the input command exists in queue list
+     *
+     * @param command command
+     * @return create command result
+     */
+    boolean verifyIsNeedCreateCommand(Command command);
+
+    /**
+     * insert or update command
+     *
+     * @param command command
+     * @return save command result
+     */
+    int saveCommand(Command command);

Review Comment:
   ```suggestion
       int upsertCommand(@Nonnull Command command);
   ```



##########
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/command/CommandService.java:
##########
@@ -0,0 +1,104 @@
+/*
+ * 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.
+ */
+
+package org.apache.dolphinscheduler.service.command;
+
+import org.apache.dolphinscheduler.dao.entity.Command;
+import org.apache.dolphinscheduler.dao.entity.ProcessInstance;
+import org.apache.dolphinscheduler.dao.entity.ProcessInstanceMap;
+import org.apache.dolphinscheduler.dao.entity.TaskInstance;
+
+import java.util.List;
+
+/**
+ * Command Service
+ */
+public interface CommandService {
+
+    /**
+     * Save error command, and delete original command. If the given command has already been moved into error command,
+     * will throw {@link java.sql.SQLIntegrityConstraintViolationException ).
+     * @param command command
+     * @param message message
+     */
+    void moveToErrorCommand(Command command, String message);
+
+    /**
+     * Create new command
+     * @param command command
+     * @return result
+     */
+    int createCommand(Command command);
+
+    /**
+     * Get command page
+     * @param pageSize page size
+     * @param pageNumber page number
+     * @return command page
+     */
+    List<Command> findCommandPage(int pageSize, int pageNumber);

Review Comment:
   Dose this method still used?



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