Пример #1
0
def cli(ctx, log_level, verbose):
    """
    Get help at https://www.meltano.com/docs/command-line-interface.html
    """
    if log_level:
        ProjectSettingsService.config_override["cli.log_level"] = log_level

    ctx.ensure_object(dict)
    ctx.obj["verbosity"] = verbose

    try:
        project = Project.find()
        setup_logging(project)

        readonly = ProjectSettingsService(project).get("project_readonly")
        if readonly:
            project.readonly = True

        if project.readonly:
            logger.debug("Project is read-only.")

        ctx.obj["project"] = project
    except ProjectNotFound as err:
        ctx.obj["project"] = None
    except IncompatibleVersionError as err:
        click.secho(
            "This Meltano project is incompatible with this version of `meltano`.",
            fg="yellow",
        )
        click.echo(
            "For more details, visit http://meltano.com/docs/installation.html#upgrading-meltano-version"
        )
        sys.exit(3)
Пример #2
0
def cli(ctx, log_level, verbose):
    """
    Get help at https://www.meltano.com/docs/command-line-interface.html
    """
    setup_logging(log_level=log_level)

    ctx.ensure_object(dict)
    ctx.obj["verbosity"] = verbose

    try:
        ctx.obj["project"] = Project.find()
    except ProjectNotFound as err:
        ctx.obj["project"] = None
    except IncompatibleVersionError as err:
        click.secho(
            "This meltano project is incompatible with this version of `meltano`.",
            fg="yellow",
        )
        click.echo(
            "Visit http://meltano.com/docs/installation.html#upgrading-meltano-version for more details."
        )
        sys.exit(3)
Пример #3
0
from meltano.core.logging import setup_logging
from meltano.core.project import ProjectReadonly

from .utils import CliError

# TODO: Importing the cli.cli module breaks other cli module imports
# This suggests a cyclic dependency or a poorly structured interface.
# This should be investigated and resolved to avoid implicit behavior
# based solely on import order.
from .cli import cli  # isort:skip
from . import (  # isort:skip # noqa: F401, WPS235
    add, config, discovery, elt, initialize, install, invoke, model, repl,
    schedule, schema, select, ui, upgrade, user,
)

setup_logging()

logger = logging.getLogger(__name__)


def main():
    # mark the current process as executed via the `cli`
    os.environ["MELTANO_JOB_TRIGGER"] = os.getenv("MELTANO_JOB_TRIGGER", "cli")
    try:
        try:
            cli(obj={"project": None})
        except ProjectReadonly as err:
            raise CliError(
                f"The requested action could not be completed: {err}") from err
        except KeyboardInterrupt:  # noqa: WPS329
            raise