ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From voze...@apache.org
Subject [40/50] incubator-ignite git commit: #IGNITE-857 Fixed review notes.
Date Fri, 29 May 2015 09:09:10 GMT
#IGNITE-857 Fixed review notes.


Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/1c04c8b4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/1c04c8b4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/1c04c8b4

Branch: refs/heads/ignite-gg-10054
Commit: 1c04c8b454c5906bec83c0096e5157dec5ab4f85
Parents: 4884995
Author: nikolay_tikhonov <ntikhonov@gridgain.com>
Authored: Thu May 28 17:46:27 2015 +0300
Committer: nikolay_tikhonov <ntikhonov@gridgain.com>
Committed: Thu May 28 17:46:27 2015 +0300

----------------------------------------------------------------------
 modules/mesos/pom.xml                           | 13 ----
 .../apache/ignite/mesos/ClusterProperties.java  |  6 +-
 .../apache/ignite/mesos/IgniteFramework.java    |  4 +-
 .../apache/ignite/mesos/IgniteScheduler.java    | 68 ++++++++++++--------
 4 files changed, 46 insertions(+), 45 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1c04c8b4/modules/mesos/pom.xml
----------------------------------------------------------------------
diff --git a/modules/mesos/pom.xml b/modules/mesos/pom.xml
index 9079c66..d3a2cef 100644
--- a/modules/mesos/pom.xml
+++ b/modules/mesos/pom.xml
@@ -30,7 +30,6 @@
     <properties>
         <jetty.version>9.2.10.v20150310</jetty.version>
         <mesos.version>0.22.0</mesos.version>
-        <slf4j.version>1.7.12</slf4j.version>
         <log4j.version>2.0.2</log4j.version>
     </properties>
 
@@ -42,24 +41,12 @@
         </dependency>
 
         <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>slf4j-api</artifactId>
-            <version>${slf4j.version}</version>
-        </dependency>
-
-        <dependency>
             <groupId>org.apache.logging.log4j</groupId>
             <artifactId>log4j-core</artifactId>
             <version>${log4j.version}</version>
         </dependency>
 
         <dependency>
-            <groupId>org.apache.logging.log4j</groupId>
-            <artifactId>log4j-slf4j-impl</artifactId>
-            <version>${log4j.version}</version>
-        </dependency>
-
-        <dependency>
             <groupId>org.eclipse.jetty</groupId>
             <artifactId>jetty-server</artifactId>
             <version>${jetty.version}</version>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1c04c8b4/modules/mesos/src/main/java/org/apache/ignite/mesos/ClusterProperties.java
----------------------------------------------------------------------
diff --git a/modules/mesos/src/main/java/org/apache/ignite/mesos/ClusterProperties.java b/modules/mesos/src/main/java/org/apache/ignite/mesos/ClusterProperties.java
index 944735e..785eddc 100644
--- a/modules/mesos/src/main/java/org/apache/ignite/mesos/ClusterProperties.java
+++ b/modules/mesos/src/main/java/org/apache/ignite/mesos/ClusterProperties.java
@@ -17,7 +17,7 @@
 
 package org.apache.ignite.mesos;
 
-import org.slf4j.*;
+import org.apache.logging.log4j.*;
 
 import java.io.*;
 import java.net.*;
@@ -29,7 +29,7 @@ import java.util.regex.*;
  */
 public class ClusterProperties {
     /** */
-    private static final Logger log = LoggerFactory.getLogger(ClusterProperties.class);
+    private static final Logger log = LogManager.getLogger(ClusterProperties.class);
 
     /** Unlimited. */
     public static final double UNLIMITED = Double.MAX_VALUE;
@@ -62,7 +62,7 @@ public class ClusterProperties {
     public static final String IGNITE_HTTP_SERVER_PORT = "IGNITE_HTTP_SERVER_PORT";
 
     /** */
-    public static final String DEFAULT_HTTP_SERVER_PORT = "47511";
+    public static final String DEFAULT_HTTP_SERVER_PORT = "48610";
 
     /** Http server host. */
     private int httpServerPort = Integer.valueOf(DEFAULT_HTTP_SERVER_PORT);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1c04c8b4/modules/mesos/src/main/java/org/apache/ignite/mesos/IgniteFramework.java
----------------------------------------------------------------------
diff --git a/modules/mesos/src/main/java/org/apache/ignite/mesos/IgniteFramework.java b/modules/mesos/src/main/java/org/apache/ignite/mesos/IgniteFramework.java
index 154385b..c30d206 100644
--- a/modules/mesos/src/main/java/org/apache/ignite/mesos/IgniteFramework.java
+++ b/modules/mesos/src/main/java/org/apache/ignite/mesos/IgniteFramework.java
@@ -19,8 +19,8 @@ package org.apache.ignite.mesos;
 
 import com.google.protobuf.*;
 import org.apache.ignite.mesos.resource.*;
+import org.apache.logging.log4j.*;
 import org.apache.mesos.*;
-import org.slf4j.*;
 
 import java.net.*;
 
@@ -29,7 +29,7 @@ import java.net.*;
  */
 public class IgniteFramework {
     /** */
-    public static final Logger log = LoggerFactory.getLogger(IgniteFramework.class);
+    public static final Logger log = LogManager.getLogger(IgniteFramework.class);
 
     /** Framework name. */
     public static final String IGNITE_FRAMEWORK_NAME = "Ignite";

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1c04c8b4/modules/mesos/src/main/java/org/apache/ignite/mesos/IgniteScheduler.java
----------------------------------------------------------------------
diff --git a/modules/mesos/src/main/java/org/apache/ignite/mesos/IgniteScheduler.java b/modules/mesos/src/main/java/org/apache/ignite/mesos/IgniteScheduler.java
index e833025..bca064f 100644
--- a/modules/mesos/src/main/java/org/apache/ignite/mesos/IgniteScheduler.java
+++ b/modules/mesos/src/main/java/org/apache/ignite/mesos/IgniteScheduler.java
@@ -18,8 +18,8 @@
 package org.apache.ignite.mesos;
 
 import org.apache.ignite.mesos.resource.*;
+import org.apache.logging.log4j.*;
 import org.apache.mesos.*;
-import org.slf4j.*;
 
 import java.util.*;
 import java.util.concurrent.atomic.*;
@@ -44,7 +44,7 @@ public class IgniteScheduler implements Scheduler {
     public static final String DELIM = ",";
 
     /** Logger. */
-    private static final Logger log = LoggerFactory.getLogger(IgniteScheduler.class);
+    private static final Logger log = LogManager.getLogger(IgniteScheduler.class);
 
     /** Mutex. */
     private static final Object mux = new Object();
@@ -72,10 +72,13 @@ public class IgniteScheduler implements Scheduler {
 
     /** {@inheritDoc} */
     @Override public void resourceOffers(SchedulerDriver schedulerDriver, List<Protos.Offer>
offers) {
-        synchronized (mux) {
-            log.debug("Offers resources: {} ", offers.size());
+        log.debug("Offers resources: {} ", offers.size());
 
-            for (Protos.Offer offer : offers) {
+        for (Protos.Offer offer : offers) {
+            Protos.TaskID taskId;
+            Protos.TaskInfo task;
+
+            synchronized (mux) {
                 IgniteTask igniteTask = checkOffer(offer);
 
                 // Decline offer which doesn't match by mem or cpu.
@@ -86,19 +89,28 @@ public class IgniteScheduler implements Scheduler {
                 }
 
                 // Generate a unique task ID.
-                Protos.TaskID taskId = Protos.TaskID.newBuilder()
+                taskId = Protos.TaskID.newBuilder()
                     .setValue(Integer.toString(taskIdGenerator.incrementAndGet())).build();
 
-                log.info("Launching task: [{}]", igniteTask);
+                log.info("Launching task: {}", igniteTask);
 
                 // Create task to run.
-                Protos.TaskInfo task = createTask(offer, igniteTask, taskId);
+                task = createTask(offer, igniteTask, taskId);
+
+                tasks.put(taskId.getValue(), igniteTask);
+            }
 
+            try {
                 schedulerDriver.launchTasks(Collections.singletonList(offer.getId()),
                     Collections.singletonList(task),
                     Protos.Filters.newBuilder().setRefuseSeconds(1).build());
+            }
+            catch (Exception e) {
+                synchronized (mux) {
+                    tasks.remove(taskId.getValue());
+                }
 
-                tasks.put(taskId.getValue(), igniteTask);
+                log.error("Failed launch task. Task id: {}. Task info: {}", taskId, task);
             }
         }
     }
@@ -274,34 +286,36 @@ public class IgniteScheduler implements Scheduler {
     @Override public void statusUpdate(SchedulerDriver schedulerDriver, Protos.TaskStatus
taskStatus) {
         final String taskId = taskStatus.getTaskId().getValue();
 
-        log.info("Received update event task: [{}] is in state: [{}]", taskId, taskStatus.getState());
+        log.info("Received update event task: {} is in state: {}", taskId, taskStatus.getState());
 
         if (taskStatus.getState().equals(Protos.TaskState.TASK_FAILED)
             || taskStatus.getState().equals(Protos.TaskState.TASK_ERROR)
             || taskStatus.getState().equals(Protos.TaskState.TASK_FINISHED)
             || taskStatus.getState().equals(Protos.TaskState.TASK_KILLED)
             || taskStatus.getState().equals(Protos.TaskState.TASK_LOST)) {
+            IgniteTask failedTask;
+
             synchronized (mux) {
-                IgniteTask failedTask = tasks.remove(taskId);
+                failedTask = tasks.remove(taskId);
+            }
 
-                if (failedTask != null) {
-                    List<Protos.Request> requests = new ArrayList<>();
+            if (failedTask != null) {
+                List<Protos.Request> requests = new ArrayList<>();
 
-                    Protos.Request request = Protos.Request.newBuilder()
-                        .addResources(Protos.Resource.newBuilder()
-                            .setType(Protos.Value.Type.SCALAR)
-                            .setName(MEM)
-                            .setScalar(Protos.Value.Scalar.newBuilder().setValue(failedTask.mem())))
-                        .addResources(Protos.Resource.newBuilder()
-                            .setType(Protos.Value.Type.SCALAR)
-                            .setName(CPU)
-                            .setScalar(Protos.Value.Scalar.newBuilder().setValue(failedTask.cpuCores())))
-                        .build();
+                Protos.Request request = Protos.Request.newBuilder()
+                    .addResources(Protos.Resource.newBuilder()
+                        .setType(Protos.Value.Type.SCALAR)
+                        .setName(MEM)
+                        .setScalar(Protos.Value.Scalar.newBuilder().setValue(failedTask.mem())))
+                    .addResources(Protos.Resource.newBuilder()
+                        .setType(Protos.Value.Type.SCALAR)
+                        .setName(CPU)
+                        .setScalar(Protos.Value.Scalar.newBuilder().setValue(failedTask.cpuCores())))
+                    .build();
 
-                    requests.add(request);
+                requests.add(request);
 
-                    schedulerDriver.requestResources(requests);
-                }
+                schedulerDriver.requestResources(requests);
             }
         }
     }
@@ -316,7 +330,7 @@ public class IgniteScheduler implements Scheduler {
     /** {@inheritDoc} */
     @Override public void registered(SchedulerDriver schedulerDriver, Protos.FrameworkID
frameworkID,
         Protos.MasterInfo masterInfo) {
-        log.info("Scheduler registered. Master: [{}:{}], framework=[{}]", masterInfo.getIp(),
masterInfo.getPort(),
+        log.info("Scheduler registered. Master: {}:{}, framework={}", masterInfo.getIp(),
masterInfo.getPort(),
             frameworkID);
     }
 


Mime
View raw message