Remotely execute program in multiple EC2 instances and wait for results

rkjt50r983

Suppose there are three EC2 instances called A,X,Y.

I'd like to execute Java program jx, jy in X, Y from other Java program ja in A. ja needs to pass command line argument of jx and jy.

For EC2 instance A, X, Y, and Java program ja, jx, jy, 
A's ja------------> X's jx
     -------------> Y's jy

The ja wait for finish of both jx and jy and obtain the result value (or file)

A's ja <---return val -------X's jx
       <---return val ------ Y's jy

Again, ja execute jx and jy with other argument determined by the return values.

ja needs to execute jx and jy for 5 times respectively.

I think psudo code of ja is like below:

for(int i = 0; i < 5; i++){
  rx = executeJX(argx);
  ry = executeJY(argy);

  waitJxJyFinish(); // jx and jy take ~30 min to finish.
  (argx, argy) = determineNextArgXandArgY(rx, ry);
}

Constraint

This is for just experimental purpose, not production for daily use, that's why the least overhead way is the best even if it's dirty way. I don't have any experience of hadoop or any other staff. Simple and easy way is welcome.

user1832464

IF you are looking to pass variables between instances in an asynchronous way to run tasks, I think the best solution would be an Amazon SQS Queue.

This would allow you to run the Java Program on X and Y, and submit the result to the queue as a message containing the result that you want to use on A. A can then intermittently poll the queue for the message, which contains the result, and then run jA using those variables.

This is the most elegant solution and decouples your application. Another alternative would be to post the results from X and Y to S3 as a file, which A then occasionally checks for and takes a copy of if it exists.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Launch multiple EC2 instances in parallel

From Dev

Run script on multiple ec2 instances

From Dev

connecting to multiple instances of EC2 with ssh

From Dev

Provision of multiple EC2 instances with Ansible

From Dev

Is it possible to execute multiple instances of a CUDA program on a multi-GPU machine?

From Dev

Shared File Systems between multiple AWS EC2 instances

From Dev

The right way to create multiple instances for Load Balancer (EC2)

From Dev

Launch multiple EC2 instances with name convention

From Dev

Same Kinesis Consumer running on multiple EC2 instances

From Dev

Execute powershell script remotely on Amazon EC2 instance from my local computer

From Dev

How to execute multiple commands remotely on few servers?

From Dev

How to execute `aws ec2 describe-instances` through Ansible?

From Dev

Wait for multiple conditions then execute function

From Dev

Multiple Instances of the same project/program

From Dev

How to remove multiple instances of a program

From Dev

Ansible: Trying to create multiple EC2 instances in multiple regions in one shot

From Dev

Is it possible to execute commands remotely (ssh), through a Java program

From Dev

How to remotely connect to multiple Glassfish 4+ instances simultaneously?

From Dev

How to remotely connect to multiple Glassfish 4+ instances simultaneously?

From Dev

How to create and run multiple ec2 instances with same configurations and software installed?

From Dev

Can you post to multiple EC2 instances behind an ELB to trigger events?

From Dev

Issue with rufus-scheduler when we have multiple EC2 instances

From Dev

Multiple EC2 Instances outgoing/outbound traffic presented from a single/common IP (not using NAT!)

From Dev

Run a command remotely on ec2

From Dev

Execute npm start remotely from 2 locations

From Dev

Xpath wildcard in Selenium to capture multiple instances of results

From Dev

QOpenGLShaderProgram - multiple instances yield corrupt results

From Dev

QOpenGLShaderProgram - multiple instances yield corrupt results

From Dev

Execute multiple downloads and wait for all to complete

Related Related

  1. 1

    Launch multiple EC2 instances in parallel

  2. 2

    Run script on multiple ec2 instances

  3. 3

    connecting to multiple instances of EC2 with ssh

  4. 4

    Provision of multiple EC2 instances with Ansible

  5. 5

    Is it possible to execute multiple instances of a CUDA program on a multi-GPU machine?

  6. 6

    Shared File Systems between multiple AWS EC2 instances

  7. 7

    The right way to create multiple instances for Load Balancer (EC2)

  8. 8

    Launch multiple EC2 instances with name convention

  9. 9

    Same Kinesis Consumer running on multiple EC2 instances

  10. 10

    Execute powershell script remotely on Amazon EC2 instance from my local computer

  11. 11

    How to execute multiple commands remotely on few servers?

  12. 12

    How to execute `aws ec2 describe-instances` through Ansible?

  13. 13

    Wait for multiple conditions then execute function

  14. 14

    Multiple Instances of the same project/program

  15. 15

    How to remove multiple instances of a program

  16. 16

    Ansible: Trying to create multiple EC2 instances in multiple regions in one shot

  17. 17

    Is it possible to execute commands remotely (ssh), through a Java program

  18. 18

    How to remotely connect to multiple Glassfish 4+ instances simultaneously?

  19. 19

    How to remotely connect to multiple Glassfish 4+ instances simultaneously?

  20. 20

    How to create and run multiple ec2 instances with same configurations and software installed?

  21. 21

    Can you post to multiple EC2 instances behind an ELB to trigger events?

  22. 22

    Issue with rufus-scheduler when we have multiple EC2 instances

  23. 23

    Multiple EC2 Instances outgoing/outbound traffic presented from a single/common IP (not using NAT!)

  24. 24

    Run a command remotely on ec2

  25. 25

    Execute npm start remotely from 2 locations

  26. 26

    Xpath wildcard in Selenium to capture multiple instances of results

  27. 27

    QOpenGLShaderProgram - multiple instances yield corrupt results

  28. 28

    QOpenGLShaderProgram - multiple instances yield corrupt results

  29. 29

    Execute multiple downloads and wait for all to complete

HotTag

Archive