question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

bug: Airflow causes meltano to print log every few seconds

See original GitHub issue

Meltano Version

2.4.0

Python Version

3.9

Bug scope

CLI (options, error messages, logging, etc.)

Operating System

macOS - Mojave

Description

Screen Shot 2022-08-30 at 9 38 58 PM

When we execute meltano invoke airflow scheduler, meltano emits a line of log displaying selected environment every few seconds. I believe the root cause is:

  1. Airflow tries to update DAG every few seconds, calling orchestrate/dags/meltano.py
  2. The script invokes meltano CLI: meltano schedule list --format=json to retrieve the schedules
  3. Meltano CLI prints the line: Environment ... is active

Here goes the orchestrators part of my meltano.yml:

  orchestrators:
  - name: airflow
    variant: apache
    pip_url: apache-airflow==2.1.2 --constraint https://raw.githubusercontent.com/apache/airflow/constraints-2.1.2/constraints-${MELTANO__PYTHON_VERSION}.txt
  files:
  - name: files-airflow
    variant: meltano
    pip_url: git+https://github.com/meltano/files-airflow.git

It’s an issue derived by side effects combined together. IMHO, the best approach (and a legit enhancement) is probably to provide a way to suppress the log message (maybe a --slient switch) with meltano schedule list command, and then we can update the script in files-airflow to turn it off when retrieving the schedules.

Although it’s also possible to suppress the log in console by passing stderr=subprocess.DEVNULL in files-airflow script, it won’t really solve the issue, for it still generates the log and flows into logging handlers other than console.

Currently, I can only work this around by raising the log level of the CLI logger. In logging.yaml:

#...
loggers:
  meltano.cli:
    level: ERROR
    handlers: [console, file]
#...

Code

No response

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:12 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
pandemicsyncommented, Aug 31, 2022

Unfortunately I had my own log config file which I believe takes precedence over --log-level so it didn’t succeed to suppressed the message.

@simonpai It’s not ideal, but you could run two logging configs. One for regular meltano invocations as you are today and one for use by the airflow dag generator, and instruct the dag generator to use the alternate one via the --log-config flag.

1reaction
aaronsteerscommented, Aug 31, 2022

Re:

I had my own log config file which I believe takes precedence over --log-level so it didn’t succeed to suppressed the message.

Should we change precedence order? Seems like CLI flag having precedence over the config file would make sense.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Log meltano elt output (#1014) · Issues - GitLab
Currently, we do not log the output of meltano elt runs (or any other cli command for what is worth). That means that...
Read more >
Command Line - Meltano Documentation
Meltano provides a command line interface (CLI) that makes it easy to manage your project, plugins, and EL(T) pipelines.To quickly find the meltano...
Read more >
meltano/CHANGELOG.md at main - GitHub
#3392 Fixes bug in meltano ui where pipelines tab would fail to load when a pipeline had no interval set. 1.101.0 - (2022-04-21) ......
Read more >
Task take very long and log printing out same line over and ...
My DAGs are dynamically generated from a JSON file that is copied to the deployment. So a DAG file generates many DAGs in...
Read more >
Apache Airflow SparkSQLOperator keeps printing empty logs
Problem solved. This is caused by a byte literal vs string literal problem if your are using Python 3.x(line 146 of ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found