How to use the dbnd._vendor.click.option function in dbnd

To help you get started, we’ve selected a few dbnd 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 databand-ai / dbnd / modules / dbnd / src / dbnd / _core / cli / cmd_heartbeat.py View on Github external
@click.option("--driver-pid", required=True, type=int)
@click.option("--tracker", required=True)
@click.option("--tracker-api", required=True)
def send_heartbeat(
    run_uid, databand_url, heartbeat_interval, driver_pid, tracker, tracker_api
):
    from dbnd import config
    from dbnd._core.settings import CoreConfig
    from dbnd._core.task_executor.heartbeat_sender import send_heartbeat_continuously

    with config(
        {
            "core": {
                "tracker": tracker.split(","),
                "tracker_api": tracker_api,
                "databand_url": databand_url,
            }
github databand-ai / dbnd / modules / dbnd / src / dbnd / _core / cli / cmd_tracker.py View on Github external
@click.option(
    "--timeout", "-t", type=int, default=120, help="Wait for tracker to be running"
)
def wait(timeout):
    with new_dbnd_context(name="new_context"):
        cfg = CoreConfig()

        tracking_store = cfg.get_tracking_store()
        logger.info("Waiting {} seconds for tracker to become ready:".format(timeout))

        is_ready = wait_until(tracking_store.is_ready, timeout)
        if not is_ready:
            logger.error("Tracker is not ready after {} seconds.".format(timeout))
            sys.exit(1)
        logger.info("Tracker is ready.")
github databand-ai / dbnd / modules / dbnd / src / dbnd / _core / cli / cmd_heartbeat.py View on Github external
@click.option("--heartbeat-interval", required=True, type=int)
@click.option("--driver-pid", required=True, type=int)
@click.option("--tracker", required=True)
@click.option("--tracker-api", required=True)
def send_heartbeat(
    run_uid, databand_url, heartbeat_interval, driver_pid, tracker, tracker_api
):
    from dbnd import config
    from dbnd._core.settings import CoreConfig
    from dbnd._core.task_executor.heartbeat_sender import send_heartbeat_continuously

    with config(
        {
            "core": {
                "tracker": tracker.split(","),
                "tracker_api": tracker_api,
                "databand_url": databand_url,
github databand-ai / dbnd / modules / dbnd / src / dbnd / _core / cli / cmd_airflow_monitor.py View on Github external
@click.option("--interval", type=click.INT)
@click.option("--url", type=click.STRING)
def airflow_monitor(interval, url):
    """Start Airflow Data Importer"""
    from dbnd import new_dbnd_context
    from dbnd._core.tracking.airflow_sync import do_import_data
    from dbnd._core.tracking.airflow_sync.converters import to_export_data

    if not url:
        url = "http://localhost:8080/admin/data_export_plugin/export_data"
    if not interval:
        interval = 10
    since = None

    with new_dbnd_context() as dc:
        while True:
            params = {}
github databand-ai / dbnd / modules / dbnd-airflow / src / dbnd_airflow / cli / cmd_airflow_db.py View on Github external
@click.option("--email", "-e", required=True, callback=validate_email)
@click.option("--firstname", "-f", required=True)
@click.option("--lastname", "-l", required=True)
@click.option(
    "--password",
    "-p",
    prompt=True,
    confirmation_prompt=True,
    hide_input=True,
    cls=NotRequiredIf,
    not_required_if="use_random_password",
)
@click.option("--use-random-password", is_flag=True)
@with_fast_dbnd_context
def db_user_create(**kwargs):
    """Create a new databand and web server user"""
    _db_user_create(**kwargs)
github databand-ai / dbnd / modules / dbnd-airflow / src / dbnd_airflow / cli / cmd_scheduler.py View on Github external
@click.option("--daemon", "-d", is_flag=True)
@click.option("--stdout", type=click.Path(exists=False))
@click.option("--stderr", type=click.Path(exists=False))
@click.option("--log-file", "-l", type=click.Path(exists=False))
def scheduler(
    dag_id,
    subdir,
    run_duration,
    num_runs,
    do_pickle,
    airflow_dags_only,
    pid,
    daemon,
    stdout,
    stderr,
    log_file,
):
github databand-ai / dbnd / modules / dbnd-airflow / src / dbnd_airflow / cli / cmd_airflow_db.py View on Github external
@click.option("--role", "-r", required=True)
@click.option("--username", "-u", required=True, callback=validate_username)
@click.option("--email", "-e", required=True, callback=validate_email)
@click.option("--firstname", "-f", required=True)
@click.option("--lastname", "-l", required=True)
@click.option(
    "--password",
    "-p",
    prompt=True,
    confirmation_prompt=True,
    hide_input=True,
    cls=NotRequiredIf,
    not_required_if="use_random_password",
)
@click.option("--use-random-password", is_flag=True)
@with_fast_dbnd_context
def db_user_create(**kwargs):
github databand-ai / dbnd / modules / dbnd-airflow / src / dbnd_airflow / cli / cmd_scheduler.py View on Github external
@click.option(
    "--num-runs",
    "-n",
    type=int,
    default=-1,
    help="Set the number of runs to execute before exiting",
)
@click.option(
    "--do-pickle",
    "-p",
    is_flag=True,
    help="Attempt to pickle the DAG object to send over "
    "to the workers, instead of letting workers run their version "
    "of the code.",
)
@click.option(
    "--airflow-dags-only", is_flag=True, help="Disable using DBND for scheduling dags."
github databand-ai / dbnd / modules / dbnd / src / dbnd / _core / cli / cmd_execute.py View on Github external
@click.option("--disable-tracking-api", is_flag=True, default=False)
@click.pass_context
def execute(ctx, dbnd_run, disable_tracking_api):
    """Execute databand primitives"""
    run = DatabandRun.load_run(
        dump_file=target(dbnd_run), disable_tracking_api=disable_tracking_api
    )
    ctx.obj = {"run": run}
github databand-ai / dbnd / modules / dbnd / src / dbnd / _core / cli / cmd_run.py View on Github external
@click.option(
    "--scheduled-date",
    "-sd",
    help="For use when setting scheduled-job-name",
    type=TZAwareDateTime(),
)
@click.option("--interactive", is_flag=True, help="Run submission in blocking mode")
@click.option(
    "--submit-driver", "submit_driver", flag_value=1, help="Run driver at remote engine"
)
@click.option(
    "--local-driver", "submit_driver", flag_value=0, help="Run driver locally"
)
@click.option(
    "--submit-tasks",
    "submit_tasks",
    flag_value=1,