コード例 #1
0
ファイル: run.py プロジェクト: ivorobts/pti-gpu
def clean():
    for sample in samples:
        path = utils.get_sample_build_path(sample[0])
        if os.path.exists(path):
            shutil.rmtree(path)

    for tool in tools:
        path = utils.get_tool_build_path(tool[0])
        if os.path.exists(path):
            shutil.rmtree(path)

    remove_python_cache(utils.get_build_utils_path())
    remove_python_cache(utils.get_script_path())
    remove_python_cache(os.path.join(utils.get_script_path(), "samples"))
    remove_python_cache(os.path.join(utils.get_script_path(), "tools"))

    for root, subdirs, files in os.walk(utils.get_root_path()):
        for file in files:
            if file.endswith(".log"):
                os.remove(os.path.join(root, file))
コード例 #2
0
def transform_config(project_name, repository_name, config):
    tasks = config.get("tasks") or config.get("platforms")
    for name, task_config in tasks.items():
        python = get_python_version_for_task(name, task_config)
        patch_script_path = utils.get_script_path("patch_repositories.py")
        ws_script_path = utils.get_script_path("create_project_workspace.py")
        task_config["setup"] = [
            "{} {}".format(python, patch_script_path),
            "{} {} --project={}".format(
                python,
                ws_script_path,
                project_name,
            ),
        ]
        for field in ("run_targets", "build_targets", "test_targets"):
            targets = task_config.get(field)
            if targets:
                task_config[field] = transform_all_targets(
                    repository_name, targets)

    return config
コード例 #3
0
ファイル: analysis.py プロジェクト: tygamvrelis/NetSoft-PPM
def parse_args():
    """Parses command-line arguments."""
    os.chdir(get_script_path())
    parser = argparse.ArgumentParser(description='Data analyzer')
    parser.add_argument('--log', help='Set log level', default='info')
    parser.add_argument('--test',
                        help='Enables test mode',
                        dest='test',
                        action='store_true',
                        default=False)
    parser.add_argument('--max_pts',
                        help='Max points before plots start wrapping',
                        type=int,
                        default=120)
    return vars(parser.parse_args())
コード例 #4
0
ファイル: config.py プロジェクト: rvanharen/wrfpy
 def _check_namelist_wps(self):
   '''
   check if namelist.wps is in the required format and has all keys needed
   '''
   # verify that example namelist.wps exists and is not removed by user
   basepath = utils.get_script_path()
   basepath = '/home/WUR/haren009/wrfpy'  # TODO: fix
   self.example_file = os.path.join(basepath, 'examples', 'namelist.wps')
   utils.check_file_exists(self.example_file)
   # load specified namelist
   self.user_nml = f90nml.read(self.config['options_wps']['namelist.wps'])
   # verify that all keys in self.user_nml are also in example namelist
   self._verify_namelist_wps_keys()
   # validate the key information specified
   self._validate_namelist_wps_keys()
コード例 #5
0
def parse_args():
    """Parses command-line arguments."""
    os.chdir(get_script_path())
    parser = argparse.ArgumentParser(description='PPM Auctioneer')
    parser.add_argument('--log', help='Set log level', default='info')
    parser.add_argument('--test',
                        help='Enables test mode',
                        dest='test',
                        action='store_true',
                        default=False)
    parser.add_argument('--use_price_token',
                        help='Enables price freeze tokens',
                        dest='use_price_token',
                        action='store_true',
                        default=False)
    return vars(parser.parse_args())
コード例 #6
0
ファイル: bidder.py プロジェクト: tygamvrelis/NetSoft-PPM
def parse_args():
    """Parses command-line arguments."""
    os.chdir(get_script_path())
    parser = argparse.ArgumentParser(description='Bidder')
    parser.add_argument('--log', help='Set log level', default='info')
    parser.add_argument(
        '--test',
        help='Enables test mode',
        dest='test', action='store_true', default=False
    )
    # Standalone mode. These arguments are for sending a specific bundle request
    parser.add_argument(
        '--bundle',
        help='Standalone mode. '
            'Indicates a specific bundle to use for a single bid request',
        default=None,
    )
    parser.add_argument(
        '--id',
        help='Standalone mode. '
            'Set customer ID. Required if using --bundle argument',
        type=check_nonnegative
    )
    parser.add_argument(
        '--use_price_token',
        help='Standalone mode. '
            'Uses price freeze tokens, if available',
        dest='use_price_token', action='store_true', default=False
    )
    parser.add_argument(
        '--delay_sec',
        help='Standalone mode. '
            'Time to wait between getting prices and requesting bid',
        type=int,
        default=None
    )
    # Repeated mode
    parser.add_argument(
        '--sim_time',
        help='How long to send requests for, in seconds',
        type=int,
        default=120
    )
    parser.add_argument(
        '--bundle_duration',
        help='How long each bundle is requested for, in seconds',
        type=int,
        default=10
    )
    parser.add_argument(
        '--bundle_mode',
        help=f'Controls which bundles are sent. Must be in {REPEATED_MODES}',
        type=check_repeated_mode,
        default=REPEATED_MODES[0]
    )
    parser.add_argument(
        '--pbar_mode',
        help=f'Controls which bundles are sent. Must be in {PBAR_MODES}',
        type=check_pbar_mode,
        default=PBAR_MODES[0]
    )
    parser.add_argument(
        '--puv_cnstr',
        help=f'Enables per-unit valuation constraint',
        dest='puv_cnstr',
        action='store_true',
        default=False
    )
    # TODO: add an option that tests the price token by maybe making 2 users slow while keeping one user fast
    return vars(parser.parse_args())