<s> """<STR_LIT>""" <EOL> import json <EOL> import logging <EOL> from perfkitbenchmarker import flags <EOL> from perfkitbenchmarker import resource <EOL> from perfkitbenchmarker . providers . gcp import util <EOL> FLAGS = flags . FLAGS <EOL> class GcpBigtableCluster ( resource . BaseResource ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , name , num_nodes , project , zone ) : <EOL> super ( GcpBigtableCluster , self ) . __init__ ( ) <EOL> self . num_nodes = num_nodes <EOL> self . name = name <EOL> self . zone = zone <EOL> self . project = project <EOL> def _Create ( self ) : <EOL> """<STR_LIT>""" <EOL> cmd = util . GcloudCommand ( self , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> self . name ) <EOL> cmd . flags [ '<STR_LIT:description>' ] = '<STR_LIT>' <EOL> cmd . flags [ '<STR_LIT>' ] = str ( self . num_nodes ) <EOL> cmd . flags [ '<STR_LIT>' ] = self . zone <EOL> cmd . flags [ '<STR_LIT>' ] = self . project <EOL> cmd . Issue ( ) <EOL> def _Delete ( self ) : <EOL> """<STR_LIT>""" <EOL> cmd = util . GcloudCommand ( self , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> self . name ) <EOL> cmd . Issue ( ) <EOL> def _Exists ( self ) : <EOL> """<STR_LIT>""" <EOL> cmd = util . GcloudCommand ( self , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT:list>' ) <EOL> cmd . flags [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> cmd . flags [ '<STR_LIT>' ] = self . project <EOL> cmd . flags [ '<STR_LIT>' ] = [ ] <EOL> stdout , stderr , retcode = cmd . Issue ( suppress_warning = True ) <EOL> if retcode != <NUM_LIT:0> : <EOL> logging . error ( '<STR_LIT>' <EOL> '<STR_LIT>' , retcode , stdout , stderr ) <EOL> return False <EOL> result = json . loads ( stdout ) <EOL> if '<STR_LIT>' not in result : <EOL> return False <EOL> clusters = { cluster [ '<STR_LIT:name>' ] : cluster for cluster in result [ '<STR_LIT>' ] } <EOL> expected_cluster_name = '<STR_LIT>' . format ( <EOL> self . project , self . zone , self . name ) <EOL> return expected_cluster_name in clusters </s>
