def _CreateTableConfig(self): """Creates a table config. Writes a valid name or an error message.""" self._ValidateToken() name = self.request.get('tableName') master_bot = self.request.get('tableBots').splitlines() tests = self.request.get('tableTests').splitlines() table_layout = self.request.get('tableLayout') user = users.get_current_user() if not name or not master_bot or not tests or not table_layout or not user: self.response.out.write( json.dumps({'error': 'Please fill out the form entirely.'})) return created_table, msg = table_config.CreateTableConfig( name=name, bots=master_bot, tests=tests, layout=table_layout, username=user.email()) if created_table: self.response.out.write(json.dumps({ 'name': name, })) else: self.response.out.write(json.dumps({ 'error': msg, }))
def _AddTableConfigDataStore(self, name, is_internal): """Add sample internal only tableConfig.""" if is_internal: self._AddInternalBotsToDataStore() else: self._AddPublicBotsToDataStore() table_config.CreateTableConfig( name=name, bots=['ChromiumPerf/win', 'ChromiumPerf/linux'], tests=['my_test_suite/my_test', 'my_test_suite/my_other_test'], layout='{ "system_health.memory_mobile/foreground/ashmem":' '["Foreground", "Ashmem"]}', username='******')
def _AddTableConfigDataStore(self, name, is_internal): """Add sample internal only tableConfig.""" keys = self._AddTests() if is_internal: self._AddInternalBotsToDataStore() else: self._AddPublicBotsToDataStore() table_config.CreateTableConfig( name=name, bots=_SAMPLE_BOTS, tests=_SAMPLE_TESTS, layout=_SAMPLE_LAYOUT, username='******') return keys
def _AddTableConfigDataStore(self, name, is_internal, is_downstream=False): """Add sample internal only tableConfig.""" keys = self._AddTests(is_downstream) if is_internal: self._AddInternalBotsToDataStore() else: self._AddPublicBotsToDataStore() table_config.CreateTableConfig( name=name, bots=_SAMPLE_BOTS if not is_downstream else _DOWNSTREAM_BOTS, tests=_SAMPLE_TESTS, layout=_SAMPLE_LAYOUT, username='******', override=0) return keys
def _CreateTableConfig(self): """Creates a table config. Writes a valid name or an error message.""" self._ValidateToken() name = self.request.get('tableName') master_bot = self.request.get('tableBots').splitlines() tests = self.request.get('tableTests').splitlines() table_layout = self.request.get('tableLayout') override = int(self.request.get('override')) user = users.get_current_user() if not name or not master_bot or not tests or not table_layout or not user: self.response.out.write( json.dumps({'error': 'Please fill out the form entirely.'})) return try: created_table = table_config.CreateTableConfig( name=name, bots=master_bot, tests=tests, layout=table_layout, username=user.email(), override=override) except table_config.BadRequestError as error: self.response.out.write(json.dumps({ 'error': error.message, })) logging.error('BadRequestError: %r', error.message) return if created_table: self.response.out.write(json.dumps({ 'name': name, })) else: self.response.out.write( json.dumps({ 'error': 'Could not create table.', })) logging.error('Could not create table.')