airflow-docker-helper-0.2.0


توضیحات

A light sdk to be used by the operators in airflow-docker and in task code to participate in host/container communication.
ویژگی مقدار
سیستم عامل -
نام فایل airflow-docker-helper-0.2.0
نام airflow-docker-helper
نسخه کتابخانه 0.2.0
نگهدارنده []
ایمیل نگهدارنده []
نویسنده Hunter Senft-Grupp
ایمیل نویسنده huntcsg@gmail.com
آدرس صفحه اصلی https://github.com/huntcsg/airflow-docker-helper
آدرس اینترنتی https://pypi.org/project/airflow-docker-helper/
مجوز Apache License 2.0
# Airflow Docker Helper [![CircleCI](https://circleci.com/gh/huntcsg/airflow-docker-helper/tree/master.svg?style=svg)](https://circleci.com/gh/huntcsg/airflow-docker-helper/tree/master) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/3e2f177d8c314f43903fe9d9b7af0647)](https://www.codacy.com/app/fool.of.god/airflow-docker-helper?utm_source=github.com&utm_medium=referral&utm_content=huntcsg/airflow-docker-helper&utm_campaign=Badge_Grade) [![codecov](https://codecov.io/gh/huntcsg/airflow-docker-helper/branch/master/graph/badge.svg)](https://codecov.io/gh/huntcsg/airflow-docker-helper) ## Description A light sdk to be used by the operators in airflow-docker and in task code to participate in host/container communication. ## Installation ```bash pip install airflow-docker-helper ``` ## Usage ### Sensor ```python from airflow_docker_helper import client if sensed: client.sensor(True) else: client.sensor(False) ``` ### Short Circuit ```python from airflow_docker_helper import client if should_short_circuit: client.short_circuit() ``` ### Branching You can pass a list... ```python from airflow_docker_helper import client branch_to_task_ids = ['foo', 'bar'] client.branch_to_tasks(branch_to_task_ids) ``` ... or a string. ```python from airflow_docker_helper import client client.branch_to_tasks('some-other-task') ``` ### Testing This library ships with a test client that mocks out all io and filesystem calls. This client also provides all of the relevant mocked out files to allow for assertions around the io. Some higher level assertions are provided. These assertions are based on the lower level file mocks. ```python from airflow_docker_helper.testing import test_client client = test_client() client.assert_not_short_circuited() # Passes client.short_circuit() client.assert_short_circuited() # Passes client.sensor(True) client.assert_sensor_called_with(True) # Passes client.assert_sensor_called_with(False) # Fails client.assert_branched_to_tasks([]) # Passes client.branch_to_tasks(['foo', 'bar']) client.assert_branched_to_tasks(['bar', 'foo']) # Passes ``` For power users, the mocks may be used directly: ```python >>> from airflow_docker_helper.testing import test_client >>> client = test_client() >>> client.branch_to_tasks(['foo', 'bar']) >>> client._mock_branch_to_tasks_file.mock_calls [call('./__AIRFLOW_META__/branch_operator.txt', 'wb'), call().__enter__(), call().write(b'["foo", "bar"]'), call().__exit__(None, None, None)] >>> client.short_circuit() >>> client._mock_short_circuit_file.mock_calls [call('./__AIRFLOW_META__/short_circuit.txt', 'wb'), call().__enter__(), call().write(b'false'), call().__exit__(None, None, None)] >>> client.sensor(True) >>> client._mock_sensor_file.mock_calls [call('./__AIRFLOW_META__/sensor.txt', 'wb'), call().__enter__(), call().write(b'true'), call().__exit__(None, None, None)] ```


نیازمندی

مقدار نام
xtr sphinx;
xtr sphinx-rtd-theme;
xtr isort;
xtr black;
xtr bumpversion;
xtr flake8;
xtr pytest;
xtr pytest-cov;
python_versio mock;


زبان مورد نیاز

مقدار نام
>=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.* Python


نحوه نصب


نصب پکیج whl airflow-docker-helper-0.2.0:

    pip install airflow-docker-helper-0.2.0.whl


نصب پکیج tar.gz airflow-docker-helper-0.2.0:

    pip install airflow-docker-helper-0.2.0.tar.gz