Show
Ignore:
Timestamp:
10.06.2013 17:09:36 (6 years ago)
Author:
jmt12
Message:

Extend hadoop_import.pl to be able to start and stop the Thrift server(s)

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • gs2-extensions/parallel-building/trunk/src/bin/script/hadoop_import.pl

    r27584 r27594  
    88  die "GSDLHOME not set\n" unless defined $ENV{'GSDLHOME'}; 
    99  die "GSDLOS not set\n" unless defined $ENV{'GSDLOS'}; 
     10  die "GEXTPARALLELBUILDING not set\n" unless defined $ENV{'GEXTPARALLELBUILDING'}; 
     11  die "GEXTPARALLELBUILDING_INSTALLED not set\n" unless defined $ENV{'GEXTPARALLELBUILDING_INSTALLED'}; 
    1012  die "HDFS HOST not set (set in <gsdl>/ext/parallel_processing/setup.bash)\n" unless defined $ENV{'HDFSHOST'}; 
    1113  die "HDFS PORT not set (set in <gsdl>/ext/parallel_processing/setup.bash)\n" unless defined $ENV{'HDFSPORT'}; 
     
    1719my $collection = 'test'; 
    1820my $use_thrift = 1; 
     21my $start_thrift = 1; 
    1922my $debug = 0; 
    2023my $dry_run = 0; 
     
    3841else 
    3942{ 
    40   print STDERR "usage: hadoop_import.pl <collection> [-debug] [-dry_run] [-disable_thrift] [-refresh_import] \n\n"; 
     43  print STDERR "usage: hadoop_import.pl <collection> [-debug] [-dry_run] [-start_thrift] [-disable_thrift] [-refresh_import] \n\n"; 
    4144} 
    4245my $offset = 1; 
     
    207210  print "       configured to use either GDBMServer or TDBServer.\n"; 
    208211  exit; 
     212} 
     213 
     214# 3.5 Start up the thrift server(s) if we've been asked to 
     215if ($start_thrift) 
     216{ 
     217  if ($is_rocks_cluster) 
     218  { 
     219    print " * Starting Thrift Servers (on compute nodes)... "; 
     220    &shellCommand('rocks run host "cd ' . $ENV{'GEXTPARALLELBUILDING'} . '/packages/ThriftFS-0.9.0/bin && ./thriftctl.sh start"'); 
     221  } 
     222  # single server 
     223  else 
     224  { 
     225    print " * Starting Thrift Server... "; 
     226    &shellCommand('cd ' . $ENV{'GEXTPARALLELBUILDING'} . '/packages/ThriftFS-0.9.0/bin && thriftctl.sh start'); 
     227  } 
     228  print "Done!\n"; 
    209229} 
    210230 
     
    234254} 
    235255 
     256# 5.5 We started them - so we better stop the thrift servers too 
     257# 3.5 Start up the thrift server(s) if we've been asked to 
     258if ($start_thrift) 
     259{ 
     260  if ($is_rocks_cluster) 
     261  { 
     262    print " * Stopping Thrift Servers (on compute nodes)... "; 
     263    &shellCommand('rocks run host "cd ' . $ENV{'GEXTPARALLELBUILDING'} . '/packages/ThriftFS-0.9.0/bin && ./thriftctl.sh stop"'); 
     264  } 
     265  # single server 
     266  else 
     267  { 
     268    print " * Stoping Thrift Server... "; 
     269    &shellCommand('cd ' . $ENV{'GEXTPARALLELBUILDING'} . '/packages/ThriftFS-0.9.0/bin && thriftctl.sh start'); 
     270  } 
     271  print "Done!\n"; 
     272} 
    236273 
    237274# 6. Gather logs