Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

An experiment at running benchmarks on multiple EC2 instances #151

Open
wants to merge 29 commits into
base: future
Choose a base branch
from

Conversation

angelhof
Copy link
Member

@angelhof angelhof commented Feb 22, 2021

This PR includes scripts that allow running experiments on multiple ec2-instances.
The infrastructure is in evaluation/multi-instance-experiment and assuming that the instances referred to in main.sh exist, we just have to call main.sh.

It now works, and can execute the eurosys one-liners experiment on two EC2 instances. The infrastructure spawns background jobs on the server and then uses a polling process to check when the experiment is done. The reason is that experiments might take a long time and if the connection drops, the experiment will stop.

What is missing:

  • [DONE] Plotting results
  • Refactoring the infrastructure so that it can be used for arbitrary experiments.
  • [WIP] Refactor the code so creation of instances and PaSh installation is also done in a script (i.e., an installation script that: for each profile in the profiles directory creates an instance and stores its id and profile name in a line in a file, that is then read by main to execute the experiment).

Especially for the second point, I would need your @zyrolasting and @nvasilakis and that is why I added you as reviewers. Any thoughts and suggestions on how to refactor this properly would be great :)

@angelhof angelhof marked this pull request as ready for review February 22, 2021 21:27
## The user and IP address or hostname of the server
HOSTNAME=$2

USER="ubuntu"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Minor nit: This can vary depending on AMI. Suggest ${3:-ubuntu}.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point, I will fix!

fi

## The path of the private key for ssh authentication
PRIVATE_KEY=$1
Copy link
Collaborator

Choose a reason for hiding this comment

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

I know this is only the first position argument, but is it reasonable to default to ~/.ssh/id_rsa here?

Copy link
Member Author

Choose a reason for hiding this comment

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

Sounds reasonable, I can make that change


## TODO: This only works if the user's name is ubuntu (and also is tied to the value in experiment-script.sh)
## Is there any better way to refactor this so that this is not an issue?
COMPLETION_FILE="/home/ubuntu/pash/done.txt"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Use $HOME?

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks, will fix!

aws ec2 start-instances --instance-ids "$instance_id"
local ip=$(wait-for-instance-ip "$instance_id");
echo "$ip"
trap "aws ec2 stop-instances --instance-ids $instance_id" EXIT
if [ "$stop_flag" -eq 1 ]; then
trap "echo Stopping instance: $instance_id; aws ec2 stop-instances --instance-ids $instance_id" EXIT
Copy link
Collaborator

Choose a reason for hiding this comment

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

I wrote this script so that it can either be run directly, or sourced. If this script is sourced, then this trap will trigger only when the shell that sourced it exits. You can support both modes by changing the function to run in a subshell (Turn the {} wrapping the function body into ())

That might be better anyway given the set -e at the top.

Copy link
Member Author

Choose a reason for hiding this comment

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

That is a good idea, I will do that too!

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.

2 participants