zhongjiajie commented on code in PR #10941:
URL: https://github.com/apache/dolphinscheduler/pull/10941#discussion_r921038105


##########
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/QueueServiceImpl.java:
##########
@@ -282,14 +282,14 @@ private boolean checkIfQueueIsInUsing(String oldQueue, 
String newQueue) {
      */
     @Override
     public Queue createQueueIfNotExists(String queue, String queueName) {
-        Queue queueObj = new Queue(queueName, queue);
-        createQueueValid(queueObj);
         Queue existsQueue = queueMapper.queryQueueName(queue, queueName);
-        if (Objects.isNull(existsQueue)) {
-            queueMapper.insert(queueObj);
-            return queueObj;
+        if (!Objects.isNull(existsQueue)) {
+            return existsQueue;

Review Comment:
   need to check if exists first instead of create new instrance



##########
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/python/PythonGateway.java:
##########
@@ -171,10 +171,11 @@ public Map<String, Long> getCodeAndVersion(String 
projectName, String processDef
         }
 
         ProcessDefinition processDefinition = 
processDefinitionMapper.queryByDefineName(project.getCode(), 
processDefinitionName);
+        // In the case project exists, but current process definition still 
not created, we should also return the init version of it
         if (processDefinition == null) {
-            String msg = String.format("Can not find valid process definition 
by name %s", processDefinitionName);
-            logger.error(msg);
-            throw new IllegalArgumentException(msg);
+            result.put("code", CodeGenerateUtils.getInstance().genCode());
+            result.put("version", 0L);
+            return result;

Review Comment:
   We need to return the init code and version here, as I said in the comment 
@hiSandog 
   > In the case project exists, but current process definition still not 
created, we should also return the init version of it



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