morpheus icon indicating copy to clipboard operation
morpheus copied to clipboard

Getting jar from CAPS project in intellije and Running it in cluster

Open MohamedRagabAnas opened this issue 5 years ago • 12 comments

Hi, I want to run specific example from CAPS project on another machine how to extract the jar file in the CAPS project (should it be a fat jar).

then how to run it that machine will it be submitted as a spark job using 'spark-submit' or how to run it in the right way

Thanks in advance

MohamedRagabAnas avatar May 06 '19 11:05 MohamedRagabAnas

Hi @MohamedRagabAnas

Just run ./gradlew allJar -x test from the root directory, which should give you a morpheus-spark-cypher-all.jar file in morpheus-spark-cypher/build/libs.

Mats-SX avatar May 06 '19 15:05 Mats-SX

Thanks @Mats-SX, How to specify a specific scala to be run. and How to run the output jar is it using spark-submit ? or java -jar ?

MohamedRagabAnas avatar May 06 '19 15:05 MohamedRagabAnas

This depends on how you've set up your Spark cluster. Generally, using spark-submit is recommended.

https://spark.apache.org/docs/latest/submitting-applications.html

Mats-SX avatar May 06 '19 15:05 Mats-SX

Thank You and How building the CAPS with multiple main classes. how to specify main class to be run.

MohamedRagabAnas avatar May 06 '19 15:05 MohamedRagabAnas

Task 'allJar' not found in root project 'okapi'. Some candidates are: 'docJar', 'jar', 'jmhJar'.

MohamedRagabAnas avatar May 06 '19 15:05 MohamedRagabAnas

That's odd. When I run ./gradlew allJar -x test from the root directory I get the expected result. Are you sure you're running exactly that command?

In order to specify main class, please refer to the standard Spark documentation. We don't do anything in particular but the standard approaches should be enough.

Mats-SX avatar May 07 '19 10:05 Mats-SX

Thanks @Mats-SX I figured out the problem was with running the command and older version of Morpheus. but according to the main class I don't mean how to specify the main class in the spark-submit in spark but how to specify it in the Morpheus build.gradle using the jar{manifest: mainclass:...}.

I'm just confused about this point if you just have the morpheus-spark-cypher-all.jar with multiple classses inside how to specify which one will be submitted or run as a job?

MohamedRagabAnas avatar May 07 '19 12:05 MohamedRagabAnas

Ok Mats I have figured this out by putting the .all Jar file into spark and running examples jar by just giving the name of the class I want to run.

MohamedRagabAnas avatar May 09 '19 20:05 MohamedRagabAnas

Ok Mats I have figured this out by putting the .all Jar file into spark and running examples jar by just giving the name of the class I want to run.

Can you tell me what's the command for running examples using .all jar file? I use spark-submit --class org.opencypher.morpheus.examples.CaseClassExample --master local morpheus-spark-cypher-0.3.3-SNAPSHOT-all.jar but it turns out ClassNotFound Error. Thanks.

zhengminlai avatar May 21 '19 03:05 zhengminlai

Ok Mats I have figured this out by putting the .all Jar file into spark and running examples jar by just giving the name of the class I want to run.

Can you tell me what's the command for running examples using .all jar file? I use spark-submit --class org.opencypher.morpheus.examples.CaseClassExample --master local morpheus-spark-cypher-0.3.3-SNAPSHOT-all.jar but it turns out ClassNotFound Error. Thanks.

@Mats-SX @MohamedRagabAnas Can u please help me with this? It's very urgent:(

zhengminlai avatar May 21 '19 04:05 zhengminlai

Hello @zhengminlai

The examples are not included in the morpheus-spark-cypher-*-all jar. This jar contains only the necessary code to develop Morpheus applications (such as the examples). In order to execute the examples, you will need to put both the all jar as well as the morpheus-examples jar on the classpath:

bin/spark-submit --master local --class org.opencypher.morpheus.examples.CaseClassExample --jars morpheus-spark-cypher-0.4.1-SNAPSHOT-all.jar morpheus-examples-0.4.1-SNAPSHOT.jar

Mats-SX avatar May 28 '19 14:05 Mats-SX

@Mats-SX the new version of Morpheus doesn't support ./gradlew allJar -x test command to get the *all.jar file and turns up this error: Task 'alljar' not found in root project 'okapi'. Some candidates are: 'docJar', 'jar', 'jmhJar'.

MohamedRagabAnas avatar Sep 17 '19 08:09 MohamedRagabAnas