You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by "PakhomovAlexander (via GitHub)" <gi...@apache.org> on 2023/06/13 14:31:22 UTC

[GitHub] [ignite-3] PakhomovAlexander commented on a diff in pull request #2146: IGNITE-19517 Cache JobClassLoaders

PakhomovAlexander commented on code in PR #2146:
URL: https://github.com/apache/ignite-3/pull/2146#discussion_r1227119099


##########
modules/code-deployment/src/main/java/org/apache/ignite/internal/deployunit/DeploymentManagerImpl.java:
##########
@@ -296,6 +319,41 @@ public CompletableFuture<Boolean> onDemandDeploy(String id, Version version) {
                     }
                     return messaging.downloadUnitContent(id, version, nodes)
                             .thenCompose(unitContent -> deployToLocalNode(id, version, unitContent));
+                })
+                .thenCompose(result -> {
+                    if (result) {
+                        return completedFuture(null);
+                    } else {
+                        LOG.error("Failed to deploy on demand deployment unit {}:{}", id, version);
+                        return clusterStatusAsync(id, version)
+                                .thenCombine(nodeStatusAsync(id, version), (clusterStatus, nodeStatus) -> {
+                                    if (clusterStatus == null) {
+                                        return CompletableFuture.<Void>failedFuture(
+                                                new DeploymentUnitNotFoundException(id, version));
+                                    } else {
+                                        return CompletableFuture.<Void>failedFuture(
+                                                new DeploymentUnitUnavailableException(
+                                                        id,
+                                                        version,
+                                                        clusterStatus,
+                                                        nodeStatus
+                                                )
+                                        );
+                                    }
+                                }).thenCompose(it -> it);
+                    }
+                });
+    }
+
+    @Override
+    public CompletableFuture<Version> detectLatestDeployedVersion(String id) {

Review Comment:
   the method contains only "Deployed" word but the filter function includes DEPLOYED or UPLOADING status. That is confusing.



##########
modules/compute/src/main/java/org/apache/ignite/internal/compute/ClassLoaderExceptionsMapper.java:
##########
@@ -0,0 +1,82 @@
+/*
+ * 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.ignite.internal.compute;
+
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.CompletionException;
+import org.apache.ignite.internal.compute.loader.JobContext;
+import org.apache.ignite.internal.deployunit.exception.DeploymentUnitNotFoundException;
+import org.apache.ignite.internal.deployunit.exception.DeploymentUnitUnavailableException;
+
+class ClassLoaderExceptionsMapper {
+    // <class_fqdn>. Deployment unit <deployment_unit_id_and ver> doesn’t exist.
+    private static final String DEPLOYMENT_UNIT_DOES_NOT_EXIST_MSG = "%s. Deployment unit %s:%s doesn’t exist";
+
+
+    // <class_fqdn>. Deployment unit <deployment_unit_id> can’t be used:
+    // [clusterStatus = <clusterDURecord.status>, nodeStatus = <nodeDURecord.status>].
+    private static final String DEPLOYMENT_UNIT_NOT_AVAILABLE_MSG = "%s. Deployment unit %s:%s can’t be used: "
+            + "[clusterStatus = %s, nodeStatus = %s]";
+
+    static CompletableFuture<JobContext> mapClassLoaderExceptions(
+            CompletableFuture<JobContext> future,
+            String jobClassName
+    ) {
+        return future.handle((v, e) -> {
+            if (e instanceof Exception) {
+                throw new CompletionException(mapException(unwrapCompletionException((Exception) e), jobClassName));
+            } else {
+                return v;

Review Comment:
   Are you sure you do not want to log the exception at least? What if it is an important error? 



-- 
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: notifications-unsubscribe@ignite.apache.org

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