Skip to content

Commit 7c27790

Browse files
author
sewen
committed
Merge branch 'version02' of https://dev.stratosphere.eu/git/stage1 into version02
Conflicts: sopremo/sopremo-base/src/main/java/eu/stratosphere/sopremo/base/Projection.java sopremo/sopremo-base/src/main/java/eu/stratosphere/sopremo/base/UnionAll.java sopremo/sopremo-common/src/main/java/eu/stratosphere/sopremo/operator/ElementaryOperator.java sopremo/sopremo-common/src/test/java/eu/stratosphere/sopremo/pact/CsvInputFormatTest.java sopremo/sopremo-common/src/test/java/eu/stratosphere/sopremo/pact/JsonInputFormatTest.java
2 parents 122bf3c + 0f9b29a commit 7c27790

File tree

419 files changed

+29192
-7291
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

419 files changed

+29192
-7291
lines changed

meteor/meteor-client/pom.xml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
4+
5+
<modelVersion>4.0.0</modelVersion>
6+
7+
<parent>
8+
<artifactId>meteor</artifactId>
9+
<groupId>eu.stratosphere</groupId>
10+
<version>0.2</version>
11+
</parent>
12+
13+
<artifactId>meteor-client</artifactId>
14+
<name>meteor-client</name>
15+
16+
<packaging>jar</packaging>
17+
18+
<dependencies>
19+
<dependency>
20+
<groupId>eu.stratosphere</groupId>
21+
<artifactId>sopremo-client</artifactId>
22+
<version>${project.version}</version>
23+
</dependency>
24+
<dependency>
25+
<groupId>eu.stratosphere</groupId>
26+
<artifactId>meteor-meteor</artifactId>
27+
<version>${project.version}</version>
28+
</dependency>
29+
</dependencies>
30+
31+
<reporting>
32+
<plugins>
33+
</plugins>
34+
</reporting>
35+
36+
<build>
37+
<plugins>
38+
</plugins>
39+
</build>
40+
41+
</project>

meteor/meteor-client/pom.xml~

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
4+
5+
<modelVersion>4.0.0</modelVersion>
6+
7+
<parent>
8+
<artifactId>meteor</artifactId>
9+
<groupId>eu.stratosphere</groupId>
10+
<version>0.2</version>
11+
</parent>
12+
13+
<artifactId>meteor-server</artifactId>
14+
<name>meteor-server</name>
15+
16+
<packaging>jar</packaging>
17+
18+
<dependencies>
19+
<dependency>
20+
<groupId>eu.stratosphere</groupId>
21+
<artifactId>sopremo-query</artifactId>
22+
<version>${project.version}</version>
23+
</dependency>
24+
<dependency>
25+
<groupId>eu.stratosphere</groupId>
26+
<artifactId>meteor-meteor</artifactId>
27+
<version>${project.version}</version>
28+
</dependency>
29+
<dependency>
30+
<groupId>eu.stratosphere</groupId>
31+
<artifactId>sopremo-base</artifactId>
32+
<version>${project.version}</version>
33+
</dependency>
34+
</dependencies>
35+
36+
<reporting>
37+
<plugins>
38+
</plugins>
39+
</reporting>
40+
41+
<build>
42+
<plugins>
43+
</plugins>
44+
</build>
45+
46+
</project>
Lines changed: 179 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,179 @@
1+
/***********************************************************************************************************************
2+
*
3+
* Copyright (C) 2010 by the Stratosphere project (http://stratosphere.eu)
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
6+
* the License. You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
11+
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
12+
* specific language governing permissions and limitations under the License.
13+
*
14+
**********************************************************************************************************************/
15+
package eu.stratosphere.meteor.client;
16+
17+
import java.io.File;
18+
import java.io.FileInputStream;
19+
import java.io.IOException;
20+
import java.net.InetSocketAddress;
21+
22+
import org.apache.commons.cli.CommandLine;
23+
import org.apache.commons.cli.CommandLineParser;
24+
import org.apache.commons.cli.HelpFormatter;
25+
import org.apache.commons.cli.OptionBuilder;
26+
import org.apache.commons.cli.Options;
27+
import org.apache.commons.cli.ParseException;
28+
import org.apache.commons.cli.PosixParser;
29+
30+
import eu.stratosphere.meteor.QueryParser;
31+
import eu.stratosphere.nephele.configuration.GlobalConfiguration;
32+
import eu.stratosphere.sopremo.client.DefaultClient;
33+
import eu.stratosphere.sopremo.client.StateListener;
34+
import eu.stratosphere.sopremo.execution.ExecutionRequest.ExecutionMode;
35+
import eu.stratosphere.sopremo.execution.ExecutionResponse.ExecutionState;
36+
import eu.stratosphere.sopremo.execution.SopremoConstants;
37+
import eu.stratosphere.sopremo.operator.SopremoPlan;
38+
39+
/**
40+
* @author Arvid Heise
41+
*/
42+
public class CLClient {
43+
private Options options = new Options();
44+
45+
private DefaultClient sopremoClient;
46+
47+
/**
48+
* Initializes CLClient.
49+
*/
50+
public CLClient() {
51+
this.initOptions();
52+
}
53+
54+
@SuppressWarnings("static-access")
55+
private void initOptions() {
56+
this.options.addOption(OptionBuilder.isRequired().
57+
withArgName("file").hasArg(true).
58+
withDescription("Executes the given script").create("f"));
59+
this.options.addOption(OptionBuilder.
60+
withArgName("config").hasArg(true).
61+
withDescription("Uses the given configuration").withLongOpt("configDir").create());
62+
this.options.addOption(OptionBuilder.
63+
withArgName("server").hasArg(true).
64+
withDescription("Uses the specified server").withLongOpt("server").create());
65+
this.options.addOption(OptionBuilder.
66+
withArgName("port").hasArg(true).
67+
withDescription("Uses the specified port").withLongOpt("port").create());
68+
this.options.addOption(OptionBuilder.
69+
withArgName("updateTime").hasArg(true).
70+
withDescription("Checks with the given update time for the current status").withLongOpt("updateTime").create());
71+
this.options.addOption(OptionBuilder.
72+
hasArg(false).
73+
withDescription("Waits until the script terminates on the server").withLongOpt("wait").create());
74+
}
75+
76+
public static void main(String[] args) {
77+
new CLClient().process(args);
78+
}
79+
80+
private void process(String[] args) {
81+
CommandLine cmd = this.parseOptions(args);
82+
final SopremoPlan plan = this.parseScript(cmd);
83+
this.configureClient(cmd);
84+
85+
this.sopremoClient.submit(plan, new StateListener() {
86+
@Override
87+
public void stateChanged(ExecutionState executionState, String detail) {
88+
System.out.println();
89+
switch (executionState) {
90+
case ENQUEUED:
91+
System.out.print("Submitted script");
92+
break;
93+
case RUNNING:
94+
System.out.print("Executing script");
95+
break;
96+
case FINISHED:
97+
System.out.print(detail);
98+
break;
99+
case ERROR:
100+
System.out.print(detail);
101+
break;
102+
}
103+
}
104+
105+
/* (non-Javadoc)
106+
* @see eu.stratosphere.sopremo.client.StateListener#stateNotChanged(eu.stratosphere.sopremo.execution.ExecutionResponse.ExecutionState, java.lang.String)
107+
*/
108+
@Override
109+
protected void stateNotChanged(ExecutionState state, String detail) {
110+
System.out.print(".");
111+
}
112+
}, cmd.hasOption("wait"));
113+
114+
this.sopremoClient.close();
115+
}
116+
117+
private void configureClient(CommandLine cmd) {
118+
String configDir = cmd.getOptionValue("configDir");
119+
GlobalConfiguration.loadConfiguration(configDir);
120+
this.sopremoClient = new DefaultClient(GlobalConfiguration.getConfiguration());
121+
122+
int updateTime = 1000;
123+
if (cmd.hasOption("updateTime"))
124+
updateTime = Integer.parseInt(cmd.getOptionValue("updateTime"));
125+
this.sopremoClient.setUpdateTime(updateTime);
126+
127+
String address = cmd.getOptionValue("server"), port = cmd.getOptionValue("port");
128+
if (address != null || port != null) {
129+
this.sopremoClient.setServerAddress(new InetSocketAddress(
130+
address == null ? "localhost" : address,
131+
port == null ? SopremoConstants.DEFAULT_SOPREMO_SERVER_IPC_PORT : Integer.parseInt(port)));
132+
}
133+
134+
this.sopremoClient.setExecutionMode(ExecutionMode.RUN_WITH_STATISTICS);
135+
}
136+
137+
protected void sleepSafely(int updateTime) {
138+
try {
139+
Thread.sleep(updateTime);
140+
} catch (InterruptedException e) {
141+
}
142+
}
143+
144+
protected void dealWithError(Exception e, final String message, Object... args) {
145+
System.err.print(String.format(message, args));
146+
if (e != null) {
147+
System.err.print(": ");
148+
System.err.print(e);
149+
}
150+
System.err.println();
151+
System.exit(1);
152+
}
153+
154+
private SopremoPlan parseScript(CommandLine cmd) {
155+
File file = new File(cmd.getOptionValue("f"));
156+
if (!file.exists())
157+
this.dealWithError(null, "Given file %s not found", file);
158+
159+
try {
160+
return new QueryParser().tryParse(new FileInputStream(file));
161+
} catch (IOException e) {
162+
this.dealWithError(e, "Error while parsing script");
163+
return null;
164+
}
165+
}
166+
167+
protected CommandLine parseOptions(String[] args) {
168+
CommandLineParser parser = new PosixParser();
169+
try {
170+
return parser.parse(this.options, args);
171+
} catch (ParseException e) {
172+
System.err.println("Cannot process the given arguments: " + e);
173+
HelpFormatter formatter = new HelpFormatter();
174+
formatter.printHelp("meteor-client.sh", this.options);
175+
System.exit(1);
176+
return null;
177+
}
178+
}
179+
}

meteor/meteor-meteor/bin/pom.xml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
4+
5+
<modelVersion>4.0.0</modelVersion>
6+
7+
<parent>
8+
<artifactId>meteor</artifactId>
9+
<groupId>eu.stratosphere</groupId>
10+
<version>0.2</version>
11+
</parent>
12+
13+
<artifactId>meteor-meteor</artifactId>
14+
<name>meteor-meteor</name>
15+
16+
<packaging>jar</packaging>
17+
18+
<dependencies>
19+
<dependency>
20+
<groupId>eu.stratosphere</groupId>
21+
<artifactId>sopremo-query</artifactId>
22+
<version>${project.version}</version>
23+
</dependency>
24+
<dependency>
25+
<groupId>eu.stratosphere</groupId>
26+
<artifactId>sopremo-base</artifactId>
27+
<version>${project.version}</version>
28+
</dependency>
29+
</dependencies>
30+
31+
<reporting>
32+
<plugins>
33+
</plugins>
34+
</reporting>
35+
36+
<build>
37+
<plugins>
38+
</plugins>
39+
</build>
40+
41+
</project>

meteor/meteor-meteor/pom.xml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
4+
5+
<modelVersion>4.0.0</modelVersion>
6+
7+
<parent>
8+
<artifactId>meteor</artifactId>
9+
<groupId>eu.stratosphere</groupId>
10+
<version>0.2</version>
11+
</parent>
12+
13+
<artifactId>meteor-meteor</artifactId>
14+
<name>meteor-meteor</name>
15+
16+
<packaging>jar</packaging>
17+
18+
<dependencies>
19+
<dependency>
20+
<groupId>eu.stratosphere</groupId>
21+
<artifactId>sopremo-query</artifactId>
22+
<version>${project.version}</version>
23+
</dependency>
24+
<dependency>
25+
<groupId>eu.stratosphere</groupId>
26+
<artifactId>sopremo-base</artifactId>
27+
<version>${project.version}</version>
28+
</dependency>
29+
</dependencies>
30+
31+
<reporting>
32+
<plugins>
33+
</plugins>
34+
</reporting>
35+
36+
<build>
37+
<plugins>
38+
</plugins>
39+
</build>
40+
41+
</project>

0 commit comments

Comments
 (0)