Example #1
0
def run_serial(
    swarming_server, isolate_server, priority, deadline, repeat, isolated_hash,
    name, bots):
  """Runs the task one at a time.

  This will be mainly bound by task scheduling latency, especially if the slaves
  are busy and the priority is low.
  """
  result = 0
  now = parallel_execution.timestamp()
  for i in xrange(repeat):
    for bot in bots:
      # Use an unique task name to ensure the task is executed.
      suffix = '/%d' % i if repeat > 1 else ''
      task_name = parallel_execution.unique_task_to_name(
          name, {'hostname': bot}, isolated_hash, now) + suffix
      cmd = [
        sys.executable, 'swarming.py', 'run',
        '--swarming', swarming_server,
        '--isolate-server', isolate_server,
        '--priority', priority,
        '--deadline', deadline,
        '--dimension', 'hostname', bot,
        '--task-name', task_name,
        isolated_hash,
      ]
      r = subprocess.call(cmd, cwd=ROOT_DIR)
      result = max(r, result)
  return result
Example #2
0
def run_serial(
    swarming_server, isolate_server, priority, deadline, repeat, isolated_hash,
    name, bots):
  """Runs the task one at a time.

  This will be mainly bound by task scheduling latency, especially if the slaves
  are busy and the priority is low.
  """
  result = 0
  now = parallel_execution.timestamp()
  for i in xrange(repeat):
    for bot in bots:
      # Use an unique task name to ensure the task is executed.
      suffix = '/%d' % i if repeat > 1 else ''
      task_name = parallel_execution.unique_task_to_name(
          name, {'id': bot}, isolated_hash, now) + suffix
      cmd = [
        sys.executable, 'swarming.py', 'run',
        '--swarming', swarming_server,
        '--isolate-server', isolate_server,
        '--priority', priority,
        '--deadline', deadline,
        '--dimension', 'id', bot,
        '--task-name', task_name,
        isolated_hash,
      ]
      r = subprocess.call(cmd, cwd=ROOT_DIR)
      result = max(r, result)
  return result
Example #3
0
def run_parallel(swarming_server, isolate_server, priority, deadline, repeat,
                 isolated_hash, name, bots):
    now = parallel_execution.timestamp()
    tasks = []
    for i in xrange(repeat):
        suffix = '/%d' % i if repeat > 1 else ''
        tasks.extend((
            parallel_execution.unique_task_to_name(
                name, {'hostname': bot}, isolated_hash, now) + suffix,
            isolated_hash,
            {
                'hostname': bot
            },
        ) for bot in bots)
    extra_args = ['--priority', priority, '--deadline', deadline]
    print('Using priority %s' % priority)
    for failed_task in parallel_execution.run_swarming_tasks_parallel(
            swarming_server, isolate_server, extra_args, tasks):
        _name, dimensions, stdout = failed_task
        print('%sFailure: %s%s\n%s' %
              (colorama.Fore.RED, dimensions, colorama.Fore.RESET, stdout))
Example #4
0
def run_parallel(
    swarming_server, isolate_server, priority, deadline, repeat, isolated_hash,
    name, bots):
  now = parallel_execution.timestamp()
  tasks = []
  for i in xrange(repeat):
    suffix = '/%d' % i if repeat > 1 else ''
    tasks.extend(
        (
          parallel_execution.unique_task_to_name(
              name, {'hostname': bot}, isolated_hash, now) + suffix,
          isolated_hash,
          {'hostname': bot},
        ) for bot in bots)
  extra_args = ['--priority', priority, '--deadline', deadline]
  print('Using priority %s' % priority)
  for failed_task in parallel_execution.run_swarming_tasks_parallel(
      swarming_server, isolate_server, extra_args, tasks):
    _name, dimensions, stdout = failed_task
    print('%sFailure: %s%s\n%s' % (
      colorama.Fore.RED, dimensions, colorama.Fore.RESET, stdout))