hama-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tjungb...@apache.org
Subject svn commit: r1177368 - in /incubator/hama/branches/HamaV2/server/src/main/java/org/apache/hama/bsp: BSPApplicationMaster.java BSPJob.java BSPJobImpl.java
Date Thu, 29 Sep 2011 17:10:32 GMT
Author: tjungblut
Date: Thu Sep 29 17:10:32 2011
New Revision: 1177368

URL: http://svn.apache.org/viewvc?rev=1177368&view=rev
Log:
-Started adding BSPJob Interface and Implementation
-Started handling of configurations


Added:
    incubator/hama/branches/HamaV2/server/src/main/java/org/apache/hama/bsp/BSPJob.java  
(with props)
    incubator/hama/branches/HamaV2/server/src/main/java/org/apache/hama/bsp/BSPJobImpl.java
  (with props)
Modified:
    incubator/hama/branches/HamaV2/server/src/main/java/org/apache/hama/bsp/BSPApplicationMaster.java

Modified: incubator/hama/branches/HamaV2/server/src/main/java/org/apache/hama/bsp/BSPApplicationMaster.java
URL: http://svn.apache.org/viewvc/incubator/hama/branches/HamaV2/server/src/main/java/org/apache/hama/bsp/BSPApplicationMaster.java?rev=1177368&r1=1177367&r2=1177368&view=diff
==============================================================================
--- incubator/hama/branches/HamaV2/server/src/main/java/org/apache/hama/bsp/BSPApplicationMaster.java
(original)
+++ incubator/hama/branches/HamaV2/server/src/main/java/org/apache/hama/bsp/BSPApplicationMaster.java
Thu Sep 29 17:10:32 2011
@@ -17,25 +17,67 @@
  */
 package org.apache.hama.bsp;
 
+import java.io.IOException;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.yarn.api.records.ApplicationId;
+import org.apache.hadoop.yarn.conf.YarnConfiguration;
 import org.apache.hadoop.yarn.ipc.YarnRPC;
 import org.apache.hadoop.yarn.util.Records;
+import org.apache.hama.HamaConfiguration;
 
+/**
+ * BSPApplicationMaster is an application master for Apache Hamas BSP Engine.
+ */
 public class BSPApplicationMaster {
 
-	private Configuration conf;
+	private static final Log LOG = LogFactory
+			.getLog(BSPApplicationMaster.class);
+
+	private Configuration localConf;
+	private Configuration jobConf;
+
+	private FileSystem fs;
+
 	private YarnRPC yarnRPC;
 	private ApplicationId appId;
 
-	private BSPApplicationMaster(String[] args) {
+	private BSPApplicationMaster(String[] args) throws IOException {
+		if (args.length != 1) {
+			throw new IllegalArgumentException();
+		}
+
+		localConf = new YarnConfiguration();
+		jobConf = getSubmitConfiguration(args[0]);
 		appId = Records.newRecord(ApplicationId.class);
-		conf = new Configuration();
-		yarnRPC = YarnRPC.create(conf);
+		yarnRPC = YarnRPC.create(localConf);
+		fs = FileSystem.get(localConf);
+	}
+
+	private Configuration getSubmitConfiguration(String path) {
+		Path jobSubmitPath = new Path(path);
+		Configuration jobConf = new HamaConfiguration();
+		jobConf.addResource(jobSubmitPath);
+		return jobConf;
+	}
+
+	private void start() {
+
 	}
 
 	public static void main(String[] args) {
-		new BSPApplicationMaster(args);
+		// TODO we expect getting the qualified path of the job.xml as the first
+		// element in the arguments
+		try {
+			new BSPApplicationMaster(args).start();
+		} catch (Exception e) {
+			LOG.fatal("Error starting BSPApplicationMaster", e);
+			System.exit(1);
+		}
 	}
 
 }

Added: incubator/hama/branches/HamaV2/server/src/main/java/org/apache/hama/bsp/BSPJob.java
URL: http://svn.apache.org/viewvc/incubator/hama/branches/HamaV2/server/src/main/java/org/apache/hama/bsp/BSPJob.java?rev=1177368&view=auto
==============================================================================
--- incubator/hama/branches/HamaV2/server/src/main/java/org/apache/hama/bsp/BSPJob.java (added)
+++ incubator/hama/branches/HamaV2/server/src/main/java/org/apache/hama/bsp/BSPJob.java Thu
Sep 29 17:10:32 2011
@@ -0,0 +1,49 @@
+/**
+ * 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.hama.bsp;
+
+import java.util.Map;
+import org.apache.hadoop.fs.Path;
+
+/**
+ * Main interface to interact with the job. Provides only getters.
+ */
+public interface BSPJob {
+
+	public enum JobState {
+		NEW, RUNNING, SUCCESS, FAILED, KILLED
+	}
+
+	BSPJobID getID();
+
+	String getName();
+
+	JobState getState();
+
+	Map<TaskAttemptID, Task> getTasks();
+
+	Task getTask(TaskAttemptID taskID);
+
+	int getTotalBSPTasks();
+
+	/**
+	 * @return a path to where the config file for this job is located.
+	 */
+	Path getConfFile();
+
+}

Propchange: incubator/hama/branches/HamaV2/server/src/main/java/org/apache/hama/bsp/BSPJob.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/hama/branches/HamaV2/server/src/main/java/org/apache/hama/bsp/BSPJobImpl.java
URL: http://svn.apache.org/viewvc/incubator/hama/branches/HamaV2/server/src/main/java/org/apache/hama/bsp/BSPJobImpl.java?rev=1177368&view=auto
==============================================================================
--- incubator/hama/branches/HamaV2/server/src/main/java/org/apache/hama/bsp/BSPJobImpl.java
(added)
+++ incubator/hama/branches/HamaV2/server/src/main/java/org/apache/hama/bsp/BSPJobImpl.java
Thu Sep 29 17:10:32 2011
@@ -0,0 +1,68 @@
+/**
+ * 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.hama.bsp;
+
+import java.util.Map;
+
+import org.apache.hadoop.fs.Path;
+
+public class BSPJobImpl implements BSPJob {
+
+	@Override
+	public BSPJobID getID() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public String getName() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public JobState getState() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public Map<TaskAttemptID, Task> getTasks() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public Task getTask(TaskAttemptID taskID) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public int getTotalBSPTasks() {
+		// TODO Auto-generated method stub
+		return 0;
+	}
+
+	@Override
+	public Path getConfFile() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+}

Propchange: incubator/hama/branches/HamaV2/server/src/main/java/org/apache/hama/bsp/BSPJobImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message