Rabu, 11 Mei 2022

Airflow Cron

Spark Submit
spark-submit --master local[4] /home/repl/spark-script.py

# Create the DAG object
dag = DAG(dag_id="car_factory_simulation",
default_args={"owner": "airflow","start_date": airflow.utils.dates.days_ago(2)},
schedule_interval="0 * * * *")

Fetch API
import requests

# Fetch the Hackernews post
resp = requests.get("https://hacker-news.firebaseio.com/v0/item/16222426.json")

# Print the response parsed as JSON
print(resp.json())

# Assign the score of the test to post_score
post_score = resp.json()["score"]
print(post_score)


Result
{'by': 'neis', 'descendants': 0, 'id': 16222426, 'score': 17, 'time': 1516800333, 'title': 'Duolingo-Style Learning for Data Science: DataCamp for Mobile', 'type': 'story', 'url': 'https://medium.com/datacamp/duolingo-style-learning-for-data-science-datacamp-for-mobile-3861d1bc02df'} 17

Tidak ada komentar:

Posting Komentar

Ad

Related Posts Plugin for WordPress, Blogger...

Label

Do it Yourself (41) Sepeda (30) soluna (30) GoPro (28) Motorcycle (28) Roda4 (23) Jual (20) Travelling (19) nouvo (19) jupiter (14) Jasa (10) mutasi (10) office (9) King (8) vw (6) Dad (5) gokart (3) Atoz (2) tamiya (2) balance bike (1) strider (1)