def run(self):
    queries = {0: query0, 1: query1, 2: query2}
    query_args = {2: {'auction_id': 'a1003'}}
    query_errors = []
    for i in self.args.query:
        self.parse_args()
        logging.info('Running query %d', i)
        launch_from_direct_runner = (self.pipeline_options.view_as(StandardOptions).runner in [None, 'DirectRunner'])
        query_duration = self.pipeline_options.view_as(TestOptions).wait_until_finish_duration
        if launch_from_direct_runner:
            command = Command(self.run_query, args=[queries[i], query_args.get(i), query_errors])
            command.run(timeout=(query_duration // 1000))
        else:
            try:
                self.run_query(queries[i], query_args.get(i), query_errors=None)
            except Exception as exc:
                query_errors.append(exc)
    if query_errors:
        logging.error('Query failed with %s', ', '.join(query_errors))
    else:
        logging.info('Queries run: %s', self.args.query)
def run(self):
    queries = {0: query0, 1: query1, 2: query2}
    query_args = {2: {'auction_id': 'a1003'}}
    query_errors = []
    for i in self.args.query:
        self.parse_args()
        logging.info('Running query %d', i)
        launch_from_direct_runner = (self.pipeline_options.view_as(StandardOptions).runner in [None, 'DirectRunner'])
        query_duration = self.pipeline_options.view_as(TestOptions).wait_until_finish_duration
        if launch_from_direct_runner:
            command = Command(self.run_query, args=[queries[i], query_args.get(i), query_errors])
            command.run(timeout=(query_duration // 1000))
        else:
            try:
                self.run_query(queries[i], query_args.get(i), query_errors=None)
            except Exception as exc:
                query_errors.append(exc)
    if query_errors:
        logging.error('Query failed with %s', ', '.join(query_errors))
    else:
        logging.info('Queries run: %s', self.args.query)