<s> """<STR_LIT>""" <EOL> import json <EOL> import httplib2 <EOL> COORDINATOR = '<STR_LIT>' <EOL> HADOOP_NAMENODE = '<STR_LIT>' <EOL> HADOOP_JOBTRACKER = '<STR_LIT>' <EOL> PORT = <NUM_LIT> <EOL> NUM_WORKERS = <NUM_LIT:20> <EOL> METADATA = '<STR_LIT>' <EOL> EDISK_LOCATION = '<STR_LIT>' <EOL> class Config ( object ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self ) : <EOL> self . port = PORT <EOL> self . ok_reply = json . dumps ( { '<STR_LIT:result>' : '<STR_LIT>' } ) <EOL> self . secret = '<STR_LIT>' <EOL> self . ip_via_api = True <EOL> self . poll_delay_secs = <NUM_LIT> <EOL> self . project_id = None <EOL> self . coordinator = COORDINATOR <EOL> self . hadoop_namenode = HADOOP_NAMENODE <EOL> self . hadoop_jobtracker = HADOOP_JOBTRACKER <EOL> self . zone = None <EOL> self . machine_type = None <EOL> self . image = None <EOL> self . disk = None <EOL> self . rw_disk_instance = None <EOL> self . external_ips = True <EOL> scope_base = '<STR_LIT>' <EOL> self . rw_storage_scope = scope_base + '<STR_LIT>' <EOL> self . ro_storage_scope = scope_base + '<STR_LIT>' <EOL> self . compute_scope = scope_base + '<STR_LIT>' <EOL> self . download_attempts = <NUM_LIT:3> <EOL> self . num_workers = NUM_WORKERS <EOL> self . hadoop_url = '<STR_LIT>' <EOL> self . hadoop_version = '<STR_LIT>' <EOL> self . hadoop_fn = '<STR_LIT>' . format ( self . hadoop_version ) <EOL> self . hadoop_bin = '<STR_LIT>' <EOL> self . edisk_location = EDISK_LOCATION <EOL> self . needed_slaves = <NUM_LIT:3> <EOL> self . gs_bucket = None <EOL> self . gs_hadoop_conf = None <EOL> self . gs_hadoop_tarball = None <EOL> self . gs_coordinators_tarball = None <EOL> self . gs_snitch_tarball = None <EOL> self . gs_tools_jar = None <EOL> def update_from_metadata ( self ) : <EOL> """<STR_LIT>""" <EOL> self . ip_via_api = False <EOL> def get_md ( key , base = METADATA + '<STR_LIT>' ) : <EOL> return httplib2 . Http ( ) . request ( base + key , '<STR_LIT:GET>' ) [ <NUM_LIT:1> ] <EOL> self . project_id = get_md ( '<STR_LIT>' , base = METADATA ) <EOL> self . secret = get_md ( '<STR_LIT>' ) <EOL> self . zone = get_md ( '<STR_LIT>' ) <EOL> self . machine_type = get_md ( '<STR_LIT>' ) <EOL> self . image = get_md ( '<STR_LIT:image>' ) <EOL> self . disk = get_md ( '<STR_LIT>' ) <EOL> self . rw_disk_instance = get_md ( '<STR_LIT>' ) <EOL> self . set_bucket ( get_md ( '<STR_LIT>' ) ) <EOL> def set_bucket ( self , bucket ) : <EOL> """<STR_LIT>""" <EOL> self . gs_bucket = bucket <EOL> url = '<STR_LIT>' . format ( bucket ) <EOL> self . gs_hadoop_conf = url + '<STR_LIT>' <EOL> self . gs_hadoop_tarball = url + self . hadoop_fn + '<STR_LIT>' <EOL> self . gs_coordinators_tarball = url + '<STR_LIT>' <EOL> self . gs_snitch_tarball = url + '<STR_LIT>' <EOL> self . gs_tools_jar = url + '<STR_LIT>' <EOL> cfg = Config ( ) </s>
