Esempio n. 1
0
def run():
    # Set global debug value and setup application logging.
    setup_logging(
        _logger, mod_cmd, '--debug' in sys.argv,
        '{0}.log'.format(mod_cmd) if '--log-file' in sys.argv else None)
    setup_unicode()

    # Setup program arguments.
    parser = argparse.ArgumentParser(prog=mod_cmd, description=mod_desc)
    parser.add_argument('--debug',
                        help='Enable debug output',
                        default=False,
                        action='store_true')  # noqa
    parser.add_argument('--log-file',
                        help='write output to a log file',
                        default=False,
                        action='store_true')  # noqa
    parser.add_argument('--project',
                        help='gcp project name',
                        default='localhost')  # noqa
    parser.add_argument('--account', help='pmi-ops account',
                        default=None)  # noqa
    parser.add_argument('--service-account',
                        help='gcp iam service account',
                        default=None)  # noqa
    args = parser.parse_args()

    with GCPProcessContext(mod_cmd, args.project, args.account,
                           args.service_account):
        process = ProgramTemplateClass(args)
        exit_code = process.run()
        return exit_code
Esempio n. 2
0
def run():
  # Set global debug value and setup application logging.
  setup_logging(_logger, mod_cmd,
                '--debug' in sys.argv, '{0}.log'.format(mod_cmd) if '--log-file' in sys.argv else None)
  setup_unicode()

  # Setup program arguments.
  parser = argparse.ArgumentParser(prog=mod_cmd, description=mod_desc)
  parser.add_argument('--debug', help='Enable debug output', default=False, action='store_true')  # noqa
  parser.add_argument('--log-file', help='write output to a log file', default=False, action='store_true')  # noqa
  parser.add_argument('--project', help='gcp project name', default='localhost')  # noqa
  parser.add_argument('--account', help='pmi-ops account', default=None)  # noqa
  parser.add_argument('--service-account', help='gcp iam service account', default=None)  # noqa
  parser.add_argument('--port', help='alternate ip port to connect to', default=None)  # noqa
  parser.add_argument('--horiz', help='participant data is horizontal in the spreadsheet',
                          default=False, action='store_true')  # noqa
  parser.add_argument('--src-csv', help='participant list csv (file/google doc id)', required=True)  # noqa
  args = parser.parse_args()

  with GCPProcessContext(mod_cmd, args.project, args.account, args.service_account) as env:
    # verify we're not getting pointed to production.
    if env['project'] == 'all-of-us-rdr-prod':
      _logger.error('using spec generator in production is not allowed.')
      return 1

    process = DataGeneratorClass(args)
    exit_code = process.run()
    return exit_code
def run():
  # Set global debug value and setup application logging.
  setup_logging(_logger, mod_cmd,
                  '--debug' in sys.argv, '{0}.log'.format(mod_cmd) if '--log-file' in sys.argv else None)
  setup_unicode()
  exit_code = 1

  # Setup program arguments.
  parser = argparse.ArgumentParser(prog=mod_cmd, description=mod_group)
  parser.add_argument('--debug', help='Enable debug output', default=False, action='store_true')  # noqa
  parser.add_argument('--log-file', help='write output to a log file', default=False, action='store_true')  # noqa
  parser.add_argument('--project', help='gcp project name', default='localhost')  # noqa
  parser.add_argument('--account', help='pmi-ops account', default=None)  # noqa
  parser.add_argument('--service-account', help='gcp iam service account', default=None) # noqa
  parser.add_argument('--port', help='alternate ip port to connect to', default=None)  # noqa
  parser.add_argument('--num_participants', type=int, help='The number of participants to create.', default=0)
  parser.add_argument('--include_physical_measurements', action='store_true',
                        help='True if physical measurements should be created')
  parser.add_argument('--include_biobank_orders', action='store_true',
                        help='True if biobank orders should be created')
  parser.add_argument('--hpo', help='The HPO name to assign participants to; defaults to random choice.')
  parser.add_argument('--create_biobank_samples', action='store_true',
                        help='True if biobank samples should be created')
  parser.add_argument('--create_samples_from_file',
                      help='Creates PM&B for existing participants from a csv file; requires path'
                           ' to file. File is expected to contain a single column of ID"s with a '
                           'leading env. identifier. i.e. P')

  args = parser.parse_args()

  if args.num_participants == 0 and not args.create_biobank_samples and not args.create_samples_from_file:
    parser.error('--num_participants must be nonzero unless --create_biobank_samples is true.')
    exit(exit_code)

  with GCPProcessContext(mod_cmd, args.project, args.account, args.service_account) as env:
    # verify we're not getting pointed to production.
    if env['project'] == 'all-of-us-rdr-prod':
      _logger.error('using spec generator in production is not allowed.')
      return 1

    process = RandomGeneratorClass(args)
    exit_code = process.run()
    return exit_code
def run():
    # Set global debug value and setup application logging.
    setup_logging(
        _logger, tool_cmd, '--debug' in sys.argv,
        '{0}.log'.format(tool_cmd) if '--log-file' in sys.argv else None)
    setup_unicode()

    # Setup program arguments.
    parser = argparse.ArgumentParser(prog=tool_cmd, description=tool_desc)
    parser.add_argument('--debug',
                        help='Enable debug output',
                        default=False,
                        action='store_true')  # noqa
    parser.add_argument('--log-file',
                        help='write output to a log file',
                        default=False,
                        action='store_true')  # noqa
    parser.add_argument('--project',
                        help='gcp project name',
                        default='localhost')  # noqa
    parser.add_argument('--account', help='pmi-ops account',
                        default=None)  # noqa
    parser.add_argument('--service-account',
                        help='gcp iam service account',
                        default=None)  # noqa
    parser.add_argument('--delete',
                        help="a comma delimited list of schema names or 'all'",
                        default=None,
                        metavar='SCHEMAS')  # noqa
    parser.add_argument('--show-schemas',
                        help='print schemas to stdout',
                        default=False,
                        action='store_true')  # noqa
    args = parser.parse_args()

    with GCPProcessContext(tool_cmd, args.project, args.account,
                           args.service_account) as gcp_env:
        process = BQMigration(args, gcp_env)
        exit_code = process.run()
        return exit_code
def run():
  # Set global debug value and setup application logging.
  setup_logging(_logger, tool_cmd,
                '--debug' in sys.argv, '{0}.log'.format(tool_cmd) if '--log-file' in sys.argv else None)
  setup_unicode()

  # Setup program arguments.
  parser = argparse.ArgumentParser(prog=tool_cmd, description=tool_desc)
  parser.add_argument('--debug', help='Enable debug output', default=False, action='store_true')  # noqa
  parser.add_argument('--log-file', help='write output to a log file', default=False, action='store_true')  # noqa
  parser.add_argument('--project', help='gcp project name', default='localhost')  # noqa
  parser.add_argument('--account', help='pmi-ops account', default=None)  # noqa
  parser.add_argument('--service-account', help='gcp iam service account', default=None)  # noqa
  parser.add_argument('--org-id', help='organization id', default=None)  # noqa
  parser.add_argument('--destination_bucket', default=None,
                      help='Override the destination bucket lookup for the given organization.')
  parser.add_argument('--dry_run', action="store_true",
                      help='Do not copy files, only print the list of files that would be copied')
  args = parser.parse_args()

  with GCPProcessContext(tool_cmd, args.project, args.account, args.service_account) as gcp_env:
    process = SyncConsentClass(args, gcp_env)
    exit_code = process.run()
    return exit_code