Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
add testing mode to load management script
  • Loading branch information
lstein committed Nov 1, 2012
1 parent c171d7f commit c2bddd2
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
2 changes: 2 additions & 0 deletions Build.PL
Expand Up @@ -64,6 +64,8 @@ my $build = GBrowseInstall->new(
'bin/gbrowse_import_ucsc_db.pl',
'bin/gbrowse_create_account.pl',
'bin/gbrowse_change_passwd.pl',
'bin/gbrowse_launch_aws_slaves.pl',
'bin/gbrowse_configure_slaves.pl',
'bin/gbrowse_metadb_config.pl',
'bin/gbrowse_grow_cloud_vol.pl',
'bin/gbrowse_slave',
Expand Down
Expand Up @@ -13,7 +13,7 @@
'remove=s' => \@to_remove,
'set=s' => \@to_set
) or die <<USAGE;
Usage: gbrowse_update_renderers.pl [--options]
Usage: gbrowse_add_slaves.pl [--options]
Options:
Expand Down
10 changes: 8 additions & 2 deletions bin/gbrowse_launch_aws_slaves.pl
Expand Up @@ -62,6 +62,7 @@

while (1) { # main loop
my $load = get_load();
warn "current load = $load\n";
my @instances = adjust_spot_requests($load);
adjust_configuration(@instances);
sleep (POLL_INTERVAL * 60);
Expand All @@ -72,7 +73,12 @@
exit 0;

sub get_load {
if (-e '/proc/loadavg') {
if (-e '/tmp/gbrowse_load') {
open my $fh,'/tmp/gbrowse_load';
chomp(my $load = <$fh>);
return $load;
}
else (-e '/proc/loadavg') {
open my $fh,'/proc/loadavg';
my ($one,$five,$fifteen) = split /\s+/,<$fh>;
return $five;
Expand Down Expand Up @@ -148,7 +154,7 @@ sub adjust_configuration {
"http://$_:8102",
"http://$_:8103")} @addresses;
my @args = map {('--set'=> "$_") } @a;
system 'sudo','gbrowse_add_slaves.pl',@args;
system 'sudo','gbrowse_configure_slaves.pl',@args;
}

sub terminate_instances {
Expand Down
3 changes: 3 additions & 0 deletions bin/gbrowse_slave_start_aws.sh
@@ -1,3 +1,6 @@
#!/bin/sh

# pass this as the user data file to the GBrowse AWS image
# in order to start up the instance in slave mode.
exec /opt/gbrowse/etc/init.d/gbrowse-slave start

0 comments on commit c2bddd2

Please sign in to comment.