warrenstephens opened a new issue #17241:
URL: https://github.com/apache/airflow/issues/17241
<!--
Welcome to Apache Airflow! For a smooth issue process, try to answer the
following questions.
Don't worry if they're not all applicable; just try to include what you can
:-)
If you need to include code snippets or logs, please put them in fenced code
blocks. If they're super-long, please use the details tag like
<details><summary>super-long log</summary> lots of stuff </details>
Please delete these comment blocks before submitting the issue.
-->
<!--
IMPORTANT!!!
PLEASE CHECK "SIMILAR TO X EXISTING ISSUES" OPTION IF VISIBLE
NEXT TO "SUBMIT NEW ISSUE" BUTTON!!!
PLEASE CHECK IF THIS ISSUE HAS BEEN REPORTED PREVIOUSLY USING SEARCH!!!
Please complete the next sections or the issue will be closed.
These questions are the first thing we need to know to understand the
context.
-->
**Apache Airflow version**:
Airflow version: 2.1.2
**Kubernetes version (if you are using kubernetes)** (use `kubectl
version`):
Client Version: version.Info{Major:"1", Minor:"21", GitVersion:"v1.21.2",
GitCommit:"092fbfbf53427de67cac1e9fa54aaa09a28371d7", GitTreeState:"clean",
BuildDate:"2021-06-16T12:59:11Z", GoVersion:"go1.16.5", Compiler:"gc",
Platform:"darwin/arm64"}
Server Version: version.Info{Major:"1", Minor:"18", GitVersion:"v1.18.10",
GitCommit:"62876fc6d93e891aa7fbe19771e6a6c03773b0f7", GitTreeState:"clean",
BuildDate:"2020-10-15T01:43:56Z", GoVersion:"go1.13.15", Compiler:"gc",
Platform:"linux/amd64"}
WARNING: version difference between client (1.21) and server (1.18) exceeds
the supported minor version skew of +/-1
**Environment**:
- **Cloud provider or hardware configuration**:
- **OS** (e.g. from /etc/os-release): macOs Big Sur 11.4
- **Kernel** (e.g. `uname -a`):
- **Install tools**:
- **Others**:
**What happened**:
```
Something bad has happened.
Please consider letting us know by creating a bug report using GitHub.
Python version: 3.9.6
Airflow version: 2.1.2
Node: helx-web-78985b668c-bwgtp
-------------------------------------------------------------------------------
Traceback (most recent call last):
File "/home/airflow/.local/lib/python3.9/site-packages/flask/app.py", line
2447, in wsgi_app
response = self.full_dispatch_request()
File "/home/airflow/.local/lib/python3.9/site-packages/flask/app.py", line
1952, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/home/airflow/.local/lib/python3.9/site-packages/flask/app.py", line
1821, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/home/airflow/.local/lib/python3.9/site-packages/flask/_compat.py",
line 39, in reraise
raise value
File "/home/airflow/.local/lib/python3.9/site-packages/flask/app.py", line
1950, in full_dispatch_request
rv = self.dispatch_request()
File "/home/airflow/.local/lib/python3.9/site-packages/flask/app.py", line
1936, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File
"/home/airflow/.local/lib/python3.9/site-packages/airflow/www/auth.py", line
34, in decorated
return func(*args, **kwargs)
File
"/home/airflow/.local/lib/python3.9/site-packages/airflow/www/decorators.py",
line 60, in wrapper
return f(*args, **kwargs)
File
"/home/airflow/.local/lib/python3.9/site-packages/airflow/www/views.py", line
1373, in run
task = dag.get_task(task_id)
File
"/home/airflow/.local/lib/python3.9/site-packages/airflow/models/dag.py", line
1547, in get_task
raise TaskNotFound(f"Task {task_id} not found")
airflow.exceptions.TaskNotFound: Task print_it not found
```
**What you expected to happen**:
I have been experimenting (for the first time) with trying to get the
PythonOperator to work -- and to see where I can get the log output to go.
I have 2 functions listed below.
The first function, print_context, causes my laptop to run out-of-memory --
and I have to reboot it. Shown farther below is how I tried to call it, but
that was commented out in order to try the 2nd function after the reboot.
The second function, my_function, caused the Airflow UI to pop-up the
"Something bad has happened." message.
I have not been able to get the PythonOperator to work.
**How to reproduce it**:
```
def print_context(ds, **kwargs):
import logging
import pprint
pprint(kwargs)
print(ds)
tlogger = logging.getLogger("airflow.task")
tlogger.info(f"kwargs: {kwargs}")
return 'done!'
def my_function(arg1):
import logging
print(f"arg1: {arg1}")
tlogger = logging.getLogger("airflow.task")
tlogger.info(f"arg1: {arg1}")
return 'done!'
```
With this in the dag:
```
LoggingMixin().log.info("hello from mixin logger")
# run_printlog = PythonOperator(
# task_id='print_it',
# provide_context=True,
# python_callable=print_context,
# dag=dag)
run_printlog = PythonOperator(
task_id='log_it',
python_callable=my_function,
op_kwargs={
'duglog': theloglevel
},
dag=dag)
log.info(f"after python operator")
```
<!---
As minimally and precisely as possible. Keep in mind we do not have access
to your cluster or dags.
If you are using kubernetes, please attempt to recreate the issue using
minikube or kind.
## Install minikube/kind
- Minikube https://minikube.sigs.k8s.io/docs/start/
- Kind https://kind.sigs.k8s.io/docs/user/quick-start/
If this is a UI bug, please provide a screenshot of the bug or a link to a
youtube video of the bug in action
You can include images using the .md style of

To record a screencast, mac users can use QuickTime and then create an
unlisted youtube video with the resulting .mov file.
--->
**Anything else we need to know**:
<!--
How often does this problem occur? Once? Every time etc?
Any relevant logs to include? Put them here in side a detail tag:
<details><summary>x.log</summary> lots of stuff </details>
-->
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]