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

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

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


##########
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:
   I don't think the mapper should be responsible for that. We have logging at other levels. 



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