You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2020/06/10 13:19:00 UTC
[GitHub] [airflow] CodingJonas edited a comment on pull request #8617: Extend docker swarm operator configuration
CodingJonas edited a comment on pull request #8617:
URL: https://github.com/apache/airflow/pull/8617#issuecomment-642002414
@nullhack I have no dedicated test dag as I didn't use a dedicated test environment (I copied the code changes from a different, existing environment), but this should work:
### Start docker swarm with network and config
```bash
docker swarm init
docker network create -d overlay --attachable private-network
echo "example config content" | docker config create the-config -
# This service does nothing but exist to be pinged at
docker service create -d --replicas 1 --network=private-network --name server_ping_me alpine tail -f /dev/null
```
### Example DAG
The task in the DAG should be able to successfully ping the other service.
```python
dag_params = dict(
dag_id='full_docker_swarm_test',
schedule_interval=None,
start_date=datetime(2020, 3, 20),
catchup=False,
)
with DAG(**dag_params) as dag:
task = DockerSwarmOperator(
task_id='ping_inside_server',
image='alpine',
api_version='auto',
networks=['private-network'],
configs=[{'source': 'the-config', 'target': 'the-config'}],
command='ping -c 4 server_ping_me',
tty=True,
)
task
```
I haven't tested the example script in this comment.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org