Я пытаюсь запустить .jar
DAG через Airlfow. У меня есть файл .sh
, который вызывает все библиотеки, необходимые для выполнения рассматриваемой банки, но я все еще сталкиваюсь с той же ошибкой с BashOperator
, здесьсодержимое файла .py
:
from airflow import DAG
from airflow.operators.bash_operator import BashOperator
from datetime import datetime
import os
import sys
create_command = "/home/user/Images/Job senority new colecttion /Skill/Skill_run.sh "
default_args = {
'owner': 'me',
'depends_on_past': False,
'start_date': datetime(2019, 5, 03),
'email_on_failure': False,
'email_on_success': False,
'provide_context': True
}
dag = DAG(dag_id='Skill_batch', default_args=default_args)
t1 = BashOperator(
task_id= 'Batch_file_sh',
bash_command='create_command',
dag=dag
)
t2 = BashOperator(
task_id='task_1',
bash_command='echo Hello, This is my first DAG in Airflow!',
dag=dag
)
t3 = BashOperator(
task_id = 'runjar',
dag = dag,
bash_command = 'java -cp /home/user/Images/Job senority new colecttion /Skill/skill.jar '
t2 >> t1 >> t3
`
вот журнал из интерфейса airflow:
[2019-05-08 15:33:24,523] {bash_operator.py:104} INFO - Temporary script location: /tmp/airflowtmpIghU_M/Batch_file_shPuscAS
[2019-05-08 15:33:24,523] {bash_operator.py:114} INFO - Running command: create_command
[2019-05-08 15:33:24,527] {bash_operator.py:123} INFO - Output:
[2019-05-08 15:33:24,528] {bash_operator.py:127} INFO - /tmp/airflowtmpIghU_M/Batch_file_shPuscAS: ligne 1: create_command : commande introuvable
[2019-05-08 15:33:24,528] {bash_operator.py:131} INFO - Command exited with return code 127
[2019-05-08 15:33:24,532] {__init__.py:1580} ERROR - Bash command failed
Traceback (most recent call last):
File "/home/user/.local/lib/python2.7/site-packages/airflow/models/__init__.py", line 1441, in _run_raw_task
result = task_copy.execute(context=context)
File "/home/user/.local/lib/python2.7/site-packages/airflow/operators/bash_operator.py", line 135, in execute
raise AirflowException("Bash command failed")
AirflowException: Bash command failed
Я проверил, что DAG находится в репозитории AIRFLOW_HOME/dags
, и разрешил *Файл 1012 * и .jar
для выполнения с chmod +x file.sh
Я также попробовал некоторые ответы здесь , но в той же ситуации дозы воздушного потока не распознают каталог пути .jar.