GitHub user assadali007 created a discussion: The scheduler does not appear to
be running. Last heartbeat was received 15 minutes ago. The DAGs list may not
update, and new tasks will not be scheduled.
**i am reading book data pipeline with apache airflow i run this example on
apache airflow the second task get_pictures python it running for past days and
it stucks i don't know what to do**
**i am learning apache airflow log show of get_pictures look like this anyone
know what i need to do,it create the folder of image but image does not
download but when i just run get_pictures function on local machine it work
fine and also download picture and when i run on dag it stuck when it appear on
get_pictures task it happening for past day until now**
`import json
import pathlib
import airflow.utils.dates
import requests
import requests.exceptions as requests_exceptions
from airflow import DAG
from airflow.operators.bash import BashOperator
from airflow.operators.python import PythonOperator
dag = DAG(
dag_id="download_rocket_launches",
description="Download rocket pictures of recently launched rockets.",
start_date=airflow.utils.dates.days_ago(1),
schedule_interval=None,
)
download_launches = BashOperator(
task_id="download_launches",
bash_command="curl -o /Users/asadali/airflow/launches.json -L
'https://ll.thespacedevs.com/2.0.0/launch/upcoming'", # noqa: E501
dag=dag,
)
def _get_pictures():
# Ensure directory exists
pathlib.Path("/Users/asadali/airflow/images").mkdir(parents=True,
exist_ok=True)
# Download all pictures in launches.json
with open("/Users/asadali/airflow/launches.json") as f:
launches = json.load(f)
image_urls = [launch["image"] for launch in launches["results"]]
for image_url in image_urls:
try:
response = requests.get(image_url)
image_filename = image_url.split("/")[-1]
target_file = f"/Users/asadali/airflow/images/{image_filename}"
with open(target_file, "wb") as f:
f.write(response.content)
print(f"Downloaded {image_url} to {target_file}")
except requests_exceptions.MissingSchema:
print(f"{image_url} appears to be an invalid URL.")
except requests_exceptions.ConnectionError:
print(f"Could not connect to {image_url}.")
get_pictures = PythonOperator(
task_id="get_pictures", python_callable=_get_pictures, dag=dag
)
notify = BashOperator(
task_id="notify",
bash_command='echo "There are now $(ls /Users/asadali/airflow/images/ | wc
-l) images."',
dag=dag,
)
download_launches >> get_pictures >> notify`
<img width="1440" height="900" alt="Screen Shot 2025-10-30 at 10 33 09 AM"
src="https://github.com/user-attachments/assets/ca23d0ce-f093-455a-bd60-74e92fc2b507"
/>
GitHub link: https://github.com/apache/airflow/discussions/57533
----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: [email protected]