You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "Jonathan Underwood (JIRA)" <ji...@apache.org> on 2017/06/17 19:17:02 UTC

[jira] [Commented] (AIRFLOW-450) example dag "example_http_operator" compatible issue with Python 3

    [ https://issues.apache.org/jira/browse/AIRFLOW-450?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16052950#comment-16052950 ] 

Jonathan Underwood commented on AIRFLOW-450:
--------------------------------------------

I don't think this is resolved, is it? The PR was closed, but no code seems to have been committed.

In any case, this is still broken in 1.8.1, which breaks `airflow initdb` on a fresh install with python 3.5:

```
$ airflow initdb
[2017-06-17 20:00:03,284] {__init__.py:57} INFO - Using executor SequentialExecutor
DB: sqlite:////opt/airflow/airflow/airflow.db
[2017-06-17 20:00:03,615] {db.py:287} INFO - Creating tables
INFO  [alembic.runtime.migration] Context impl SQLiteImpl.
INFO  [alembic.runtime.migration] Will assume non-transactional DDL.
INFO  [alembic.runtime.migration] Running upgrade  -> e3a246e0dc1, current schema
INFO  [alembic.runtime.migration] Running upgrade e3a246e0dc1 -> 1507a7289a2f, create is_encrypted
/opt/airflow/lib64/python3.5/site-packages/alembic/util/messaging.py:69: UserWarning: Skipping unsupported ALTER for creation of implicit constraint
  warnings.warn(msg)
INFO  [alembic.runtime.migration] Running upgrade 1507a7289a2f -> 13eb55f81627, maintain history for compatibility with earlier migrations
INFO  [alembic.runtime.migration] Running upgrade 13eb55f81627 -> 338e90f54d61, More logging into task_isntance
INFO  [alembic.runtime.migration] Running upgrade 338e90f54d61 -> 52d714495f0, job_id indices
INFO  [alembic.runtime.migration] Running upgrade 52d714495f0 -> 502898887f84, Adding extra to Log
INFO  [alembic.runtime.migration] Running upgrade 502898887f84 -> 1b38cef5b76e, add dagrun
INFO  [alembic.runtime.migration] Running upgrade 1b38cef5b76e -> 2e541a1dcfed, task_duration
INFO  [alembic.runtime.migration] Running upgrade 2e541a1dcfed -> 40e67319e3a9, dagrun_config
INFO  [alembic.runtime.migration] Running upgrade 40e67319e3a9 -> 561833c1c74b, add password column to user
INFO  [alembic.runtime.migration] Running upgrade 561833c1c74b -> 4446e08588, dagrun start end
INFO  [alembic.runtime.migration] Running upgrade 4446e08588 -> bbc73705a13e, Add notification_sent column to sla_miss
INFO  [alembic.runtime.migration] Running upgrade bbc73705a13e -> bba5a7cfc896, Add a column to track the encryption state of the 'Extra' field in connection
INFO  [alembic.runtime.migration] Running upgrade bba5a7cfc896 -> 1968acfc09e3, add is_encrypted column to variable table
INFO  [alembic.runtime.migration] Running upgrade 1968acfc09e3 -> 2e82aab8ef20, rename user table
INFO  [alembic.runtime.migration] Running upgrade 2e82aab8ef20 -> 211e584da130, add TI state index
INFO  [alembic.runtime.migration] Running upgrade 211e584da130 -> 64de9cddf6c9, add task fails journal table
INFO  [alembic.runtime.migration] Running upgrade 64de9cddf6c9 -> f2ca10b85618, add dag_stats table
INFO  [alembic.runtime.migration] Running upgrade f2ca10b85618 -> 4addfa1236f1, Add fractional seconds to mysql tables
INFO  [alembic.runtime.migration] Running upgrade 4addfa1236f1 -> 8504051e801b, xcom dag task indices
INFO  [alembic.runtime.migration] Running upgrade 8504051e801b -> 5e7d17757c7a, add pid field to TaskInstance
INFO  [alembic.runtime.migration] Running upgrade 5e7d17757c7a -> 127d2bf2dfa7, Add dag_id/state index on dag_run table
ERROR [airflow.models.DagBag] Failed to import: /opt/airflow/lib64/python3.5/site-packages/airflow/example_dags/example_http_operator.py
Traceback (most recent call last):
  File "/opt/airflow/lib64/python3.5/site-packages/airflow/models.py", line 264, in process_file
    m = imp.load_source(mod_name, filepath)
  File "/opt/rh/rh-python35/root/usr/lib64/python3.5/imp.py", line 172, in load_source
    module = _load(spec)
  File "<frozen importlib._bootstrap>", line 693, in _load
  File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 662, in exec_module
  File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
  File "/opt/airflow/lib64/python3.5/site-packages/airflow/example_dags/example_http_operator.py", line 20, in <module>
    from airflow.operators.sensors import HttpSensor
  File "/opt/airflow/lib64/python3.5/site-packages/airflow/operators/sensors.py", line 32, in <module>
    from airflow.hooks.hdfs_hook import HDFSHook
  File "/opt/airflow/lib64/python3.5/site-packages/airflow/hooks/hdfs_hook.py", line 20, in <module>
    from snakebite.client import Client, HAClient, Namenode, AutoConfigClient
  File "/opt/airflow/lib64/python3.5/site-packages/snakebite/client.py", line 1473
    baseTime = min(time * (1L << retries), cap);
                            ^
SyntaxError: invalid syntax
Done.
```

> example dag "example_http_operator" compatible issue with Python 3
> ------------------------------------------------------------------
>
>                 Key: AIRFLOW-450
>                 URL: https://issues.apache.org/jira/browse/AIRFLOW-450
>             Project: Apache Airflow
>          Issue Type: Bug
>          Components: docs
>    Affects Versions: Airflow 1.7.1
>            Reporter: Lai Qiang Ding
>            Assignee: Lai Qiang Ding
>            Priority: Minor
>             Fix For: Airflow 2.0
>
>
> it reports error when running the example "example_http_operator" under python3
> lding-mbp:~ wjo1212$ airflow run example_http_operator http_sensor_check 2016-08-04
> {code}
> [2016-08-20 20:44:36,687] {__init__.py:36} INFO - Using executor SequentialExecutor
> Sending to executor.
> [2016-08-20 20:44:37,829] {__init__.py:36} INFO - Using executor SequentialExecutor
> Logging into: /Users/wjo1212/airflow/logs/example_http_operator/http_sensor_check/2016-08-04T00:00:00
> [2016-08-20 20:44:39,081] {__init__.py:36} INFO - Using executor SequentialExecutor
> /Users/wjo1212/python3_study/lib/python3.4/site-packages/requests/packages/urllib3/connectionpool.py:838: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/security.html
>   InsecureRequestWarning)
> Traceback (most recent call last):
>   File "/Users/wjo1212/python3_study/bin/airflow", line 15, in <module>
>     args.func(args)
>   File "/Users/wjo1212/python3_study/lib/python3.4/site-packages/airflow/bin/cli.py", line 237, in run
>     pool=args.pool,
>   File "/Users/wjo1212/python3_study/lib/python3.4/site-packages/airflow/utils/db.py", line 53, in wrapper
>     result = func(*args, **kwargs)
>   File "/Users/wjo1212/python3_study/lib/python3.4/site-packages/airflow/models.py", line 1245, in run
>     result = task_copy.execute(context=context)
>   File "/Users/wjo1212/python3_study/lib/python3.4/site-packages/airflow/operators/sensors.py", line 56, in execute
>     while not self.poke(context):
>   File "/Users/wjo1212/python3_study/lib/python3.4/site-packages/airflow/operators/sensors.py", line 514, in poke
>     return self.response_check(response)
>   File "/Users/wjo1212/python3_study/lib/python3.4/site-packages/airflow/example_dags/example_http_operator.py", line 72, in <lambda>
>     response_check=lambda response: True if "Google" in response.content else False,
> TypeError: 'str' does not support the buffer interface
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)