How to use the tuna.executors.Executor function in tuna

To help you get started, we’ve selected a few tuna examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ChristophAlt / tuna / tuna / executors / ray_executor.py View on Github external
import argparse
import logging
import json
import ray

from ray.tune import register_trainable, run_experiments
from ray.tune.function_runner import StatusReporter
from tuna.executors import Executor
from tuna.runners import Runner

from typing import Dict, Optional, Any, Callable

logger = logging.getLogger(__name__)  # pylint: disable=invalid-name


class RayExecutor(Executor):
    name = "Ray"

    def __init__(self, runner: Runner) -> None:
        super(RayExecutor, self).__init__(runner)

    def default_argument_parser(self):
        parser = argparse.ArgumentParser(description="Run tuna")

        parser.add_argument(
            "--experiment-name",
            type=str,
            required=True,
            help="a name for the experiment",
        )
        parser.add_argument(
            "--num-cpus",