<s> import boto <EOL> import sys , time <EOL> import os <EOL> APPSCALE_HOME = os . environ . get ( "<STR_LIT>" ) <EOL> if APPSCALE_HOME : <EOL> pass <EOL> else : <EOL> print "<STR_LIT>" <EOL> exit ( <NUM_LIT:1> ) <EOL> ACCESS_KEY = os . environ . get ( "<STR_LIT>" ) <EOL> if ACCESS_KEY : <EOL> pass <EOL> else : <EOL> print "<STR_LIT>" <EOL> exit ( <NUM_LIT:1> ) <EOL> SECRET_KEY = os . environ . get ( "<STR_LIT>" ) <EOL> if SECRET_KEY : <EOL> pass <EOL> else : <EOL> print "<STR_LIT>" <EOL> exit ( <NUM_LIT:1> ) <EOL> APPSCALE_DOMAIN = "<STR_LIT>" <EOL> import appscale_datastore <EOL> import string <EOL> from dbconstants import * <EOL> def domain_exists ( sdb , name ) : <EOL> try : <EOL> sdb . get_domain ( name , validate = True ) <EOL> print "<STR_LIT>" <EOL> return True <EOL> except : <EOL> print "<STR_LIT>" <EOL> return False <EOL> def prime_simpledb ( ) : <EOL> print "<STR_LIT>" <EOL> print "<STR_LIT>" + ACCESS_KEY <EOL> print "<STR_LIT>" + SECRET_KEY <EOL> sdb = boto . connect_sdb ( ACCESS_KEY , SECRET_KEY ) <EOL> while True : <EOL> if not domain_exists ( sdb , APPSCALE_DOMAIN ) : <EOL> break <EOL> try : <EOL> sdb . delete_domain ( APPSCALE_DOMAIN ) <EOL> print "<STR_LIT>" <EOL> except : <EOL> print "<STR_LIT>" <EOL> time . sleep ( <NUM_LIT:5> ) <EOL> while True : <EOL> if domain_exists ( sdb , APPSCALE_DOMAIN ) : <EOL> break <EOL> print "<STR_LIT>" <EOL> sdb . create_domain ( APPSCALE_DOMAIN ) <EOL> time . sleep ( <NUM_LIT:5> ) <EOL> db = appscale_datastore . DatastoreFactory . getDatastore ( "<STR_LIT>" ) <EOL> db . create_table ( USERS_TABLE , USERS_SCHEMA ) <EOL> db . create_table ( APPS_TABLE , APPS_SCHEMA ) <EOL> users_schema = db . get_schema ( USERS_TABLE ) <EOL> apps_schema = db . get_schema ( APPS_TABLE ) <EOL> if len ( users_schema ) > <NUM_LIT:1> and len ( apps_schema ) > <NUM_LIT:1> : <EOL> print "<STR_LIT>" <EOL> print users_schema <EOL> print apps_schema <EOL> return <NUM_LIT:0> <EOL> else : <EOL> print "<STR_LIT>" <EOL> return <NUM_LIT:1> <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> sys . exit ( prime_simpledb ( ) ) </s>
