Skip to content

Conversation

@ashishm07
Copy link
Contributor

Deployment Unit - Complete automation and standardization of all examples containing Deployment Unit
Minor bug fixes to support complete automation.

 
Tested on : apacheignite/ignite:3.1.0
 
Repo : https://github.com/apache/ignite-3/tree/main/examples
 
Absolute Path of affected files :
 
examples/java/src/main/java/org/apache/ignite/example/compute/*  – All files under compute 

examples/java/src/main/java/org/apache/ignite/example/code/deployment/CodeDeploymentExample.java

examples/java/src/main/java/org/apache/ignite/example/serialization/SerializationExample.java

examples/java/src/main/java/org/apache/ignite/example/streaming/DistributedComputeWithReceiverExample.java

examples/java/src/main/java/org/apache/ignite/example/streaming/MultiTableDataStreamerExample.java

Sample Error : 
Exception in thread "main" org.apache.ignite.compute.ComputeException: IGN-COMPUTE-9 Job execution failed: java.lang.ClassNotFoundException: org.apache.ignite.example.compute.ComputeColocatedExample$PrintAccountInfoJob. Deployment unit computeExampleUnit:1.0.0 doesn't exist TraceId:e232314f

Solution : Completely automated deployment unit dependent examples and made minor bug fixes to support the same

* High-priority job.
*/
private static class HighPriorityJob implements ComputeJob<Integer, String> {
public static class HighPriorityJob implements ComputeJob<Integer, String> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the reason behind changing the visibility scope? Here and in all other implementations of ComputeJob.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made it public/static so Ignite can access and create the job class remotely without instantiation errors.
DeploymentUnit is not able to find these jobs unless we make it accessible remotely

@@ -1,33 +1,28 @@
/*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please keep the header with licensing info.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have added the licensing info back.

}
}
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No reason to change this file. Please revert it (keep existing newlines).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reverted to original.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's revert the file completely.


System.out.println("\nConfiguring compute job...");

// 1) Check if deployment unit already exists
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is step 2?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing all comments as previously advised


System.out.println("\nConfiguring compute job...");

// 1) Check if deployment unit already exists
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing all comments as previously advised

Statement stmt = conn.createStatement()
) {

stmt.executeUpdate("DROP TABLE IF EXISTS Person");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a bad practice, an example must not delete tables that it did not create.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion received. Reverted unintended file addition - The file is being handled in a separate PR : #7103

stmt.executeUpdate("DROP TABLE IF EXISTS Person");

stmt.executeUpdate(
"CREATE TABLE IF NOT EXISTS Person ("
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should avoid using IF NOT EXISTS/IF EXISTS if the table already exists - the example shouldn't work because the table schema might be different and we'll get confusing errors.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion received. Reverted unintended file addition - The file is being handled in a separate PR : #7103

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants