def main(args):
  """Note: this is solely to run the current master's code and can totally
  differ from the underlying script flags.

  To update these flags:
  - Update the following code to support both the previous flag and the new
    flag.
  - Change scripts/master/factory/swarm_commands.py to pass the new flag.
  - Restart all the masters using swarming.
  - Remove the old flag from this code.
  """
  client = swarming_utils.find_client(os.getcwd())
  if not client:
    print >> sys.stderr, 'Failed to find swarm(ing)_client'
    return 1
  version = swarming_utils.get_version(client)
  if version < (0, 3):
    print >> sys.stderr, (
        '%s is version %s which is too old. Please run the test locally' %
        (client, '.'.join(version)))
    return 1

  parser = optparse.OptionParser(description=sys.modules[__name__].__doc__)
  parser.add_option('--verbose', action='store_true')
  parser.add_option('--swarming')
  parser.add_option('--isolate-server')
  chromium_utils.AddPropertiesOptions(parser)
  options, args = parser.parse_args(args)
  if args:
    parser.error('Unsupported args: %s' % args)
  if not options.swarming or not options.isolate_server:
    parser.error('Require both --swarming and --isolate-server')

  logging.basicConfig(level=logging.DEBUG if options.verbose else logging.ERROR)
  # Loads the other flags implicitly.
  slave_os, priority, steps, builder, build_number = process_build_properties(
      options)
  logging.info('To run: %s, %s, %s', slave_os, priority, steps)
  if not steps:
    print('Nothing to trigger')
    annotator.AdvancedAnnotationStep(sys.stdout, False).step_warnings()
    return 0
  print('Selected tests:')
  print('\n'.join(' %s' % s for s in sorted(steps)))
  selected_os = swarming_utils.OS_MAPPING[slave_os]
  print('Selected OS: %s' % selected_os)
  return drive_many(
      client,
      version,
      options.swarming,
      options.isolate_server,
      priority,
      {'os': selected_os},
      steps,
      builder,
      build_number)
def determine_version_and_run_handler(client, options, test_name):
  """Executes the proper handler based on the code layout and --version
  support.
  """
  old_test_name, new_test_name = process_build_properties(options, test_name)
  if os.path.isfile(os.path.join(client, 'swarm_get_results.py')):
    # Oh, that's old.
    return v0(client, options, old_test_name)
  version = swarming_utils.get_version(client)
  if version < (0, 4):
    return v0_1(client, options, old_test_name)
  return v0_4(client, options, new_test_name)
Esempio n. 3
0
def determine_version_and_run_handler(client, options, test_name):
    """Executes the proper handler based on the code layout and --version
  support.
  """
    old_test_name, new_test_name = process_build_properties(options, test_name)
    if os.path.isfile(os.path.join(client, 'swarm_get_results.py')):
        # Oh, that's old.
        return v0(client, options, old_test_name)
    version = swarming_utils.get_version(client)
    if version < (0, 4):
        return v0_1(client, options, old_test_name)
    return v0_4(client, options, new_test_name)
Esempio n. 4
0
def main(args):
    """Note: this is solely to run the current master's code and can totally
  differ from the underlying script flags.

  To update these flags:
  - Update the following code to support both the previous flag and the new
    flag.
  - Change scripts/master/factory/swarm_commands.py to pass the new flag.
  - Restart all the masters using swarming.
  - Remove the old flag from this code.
  """
    client = swarming_utils.find_client(os.getcwd())
    if not client:
        print >> sys.stderr, 'Failed to find swarm(ing)_client'
        return 1
    version = swarming_utils.get_version(client)
    if version < (0, 3):
        print >> sys.stderr, (
            '%s is version %s which is too old. Please run the test locally' %
            (client, '.'.join(version)))
        return 1

    parser = optparse.OptionParser(description=sys.modules[__name__].__doc__)
    parser.add_option('--verbose', action='store_true')
    parser.add_option('--swarming')
    parser.add_option('--isolate-server')
    chromium_utils.AddPropertiesOptions(parser)
    options, args = parser.parse_args(args)
    if args:
        parser.error('Unsupported args: %s' % args)
    if not options.swarming or not options.isolate_server:
        parser.error('Require both --swarming and --isolate-server')

    logging.basicConfig(
        level=logging.DEBUG if options.verbose else logging.ERROR)
    # Loads the other flags implicitly.
    slave_os, priority, steps, builder, build_number = process_build_properties(
        options)
    logging.info('To run: %s, %s, %s', slave_os, priority, steps)
    if not steps:
        print('Nothing to trigger')
        annotator.AdvancedAnnotationStep(sys.stdout, False).step_warnings()
        return 0
    print('Selected tests:')
    print('\n'.join(' %s' % s for s in sorted(steps)))
    selected_os = swarming_utils.OS_MAPPING[slave_os]
    print('Selected OS: %s' % selected_os)
    return drive_many(client, version, options.swarming,
                      options.isolate_server, priority, {'os': selected_os},
                      steps, builder, build_number)
Esempio n. 5
0
def trigger(client, swarming, isolate_server, priority, tasks, task_prefix,
            slave_os):
    """Executes the proper handler based on the code layout and --version support.
  """
    if os.path.isfile(os.path.join(client, 'swarm_get_results.py')):
        # Oh, that's old. This can be removed on 2014-01-01 and replaced on hard
        # failure if swarming.py doesn't exist.
        return v0(client, swarming, isolate_server, tasks, task_prefix,
                  slave_os)

    version = swarming_utils.get_version(client)
    if version < (0, 3):
        return v0_1(client, swarming, isolate_server, priority, tasks,
                    task_prefix, slave_os)
    if version < (0, 4):
        return v0_3(client, swarming, isolate_server, priority, tasks,
                    task_prefix, slave_os)
    # It is not using <buildername>-<buildnumber>- anymore.
    return v0_4(client, swarming, isolate_server, priority, tasks, slave_os)
def trigger(
    client, swarming, isolate_server, priority, tasks, task_prefix, slave_os):
  """Executes the proper handler based on the code layout and --version support.
  """
  if os.path.isfile(os.path.join(client, 'swarm_get_results.py')):
    # Oh, that's old. This can be removed on 2014-01-01 and replaced on hard
    # failure if swarming.py doesn't exist.
    return v0(client, swarming, isolate_server, tasks, task_prefix, slave_os)

  version = swarming_utils.get_version(client)
  if version < (0, 3):
    return v0_1(
        client, swarming, isolate_server, priority, tasks, task_prefix,
        slave_os)
  if version < (0, 4):
    return v0_3(
        client, swarming, isolate_server, priority, tasks, task_prefix,
        slave_os)
  # It is not using <buildername>-<buildnumber>- anymore.
  return v0_4(client, swarming, isolate_server, priority, tasks, slave_os)