-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 2024-06-10-15-48-38 * 2024-06-10-15-58-15 * 2024-06-10-16-05-48 - remove-redundant-commands * 2024-06-12-14-45-15 * 2024-06-12-15-03-50 * 2024-06-12-15-12-09 * 2024-06-12-15-13-08 * 2024-06-12-15-15-49 * 2024-06-12-15-18-28 * 2024-06-12-15-19-26 * 2024-06-12-15-25-54 * 2024-06-12-15-26-39 * 2024-06-12-15-32-36 * 2024-06-12-15-40-45 --------- Co-authored-by: JosephKevinMachado <[email protected]>
- Loading branch information
1 parent
4d409e1
commit 3d1d8fb
Showing
23 changed files
with
765 additions
and
144 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
python 3.11.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
FROM apache/airflow:2.2.0 | ||
FROM apache/airflow:2.9.2 | ||
COPY requirements.txt / | ||
RUN pip install --no-cache-dir -r /requirements.txt | ||
|
||
COPY quarto.sh / | ||
RUN cd / && bash /quarto.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/bash | ||
|
||
curl -L -o ~/quarto-1.5.43-linux-amd64.tar.gz https://github.com/quarto-dev/quarto-cli/releases/download/v1.5.43/quarto-1.5.43-linux-amd64.tar.gz | ||
mkdir ~/opt | ||
tar -C ~/opt -xvzf ~/quarto-1.5.43-linux-amd64.tar.gz | ||
|
||
mkdir ~/.local/bin | ||
ln -s ~/opt/quarto-1.5.43/bin/quarto ~/.local/bin/quarto | ||
|
||
( echo ""; echo 'export PATH=$PATH:~/.local/bin\n' ; echo "" ) >> ~/.profile | ||
source ~/.profile | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,13 @@ | ||
black==22.8.0 | ||
flake8==5.0.4 | ||
mypy==0.971 | ||
isort==5.10.1 | ||
moto[all]==4.0.6 | ||
pytest==7.0.1 | ||
pytest-mock==3.6.1 | ||
apache-airflow-client==2.3.0 | ||
yoyo-migrations==8.0.0 | ||
black==24.4.2 | ||
flake8==7.0.0 | ||
mypy==1.10.0 | ||
isort==5.13.2 | ||
moto[all]==5.0.9 | ||
pytest==8.2.2 | ||
pytest-mock==3.14.0 | ||
apache-airflow-client==2.9.0 | ||
yoyo-migrations==8.2.0 | ||
duckdb==1.0.0 | ||
plotly==5.22.0 | ||
jupyter==1.0.0 | ||
types-requests==2.32.0.20240602 |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import csv | ||
import os | ||
from datetime import datetime, timedelta | ||
|
||
import requests | ||
|
||
from airflow import DAG | ||
from airflow.decorators import task | ||
from airflow.operators.bash import BashOperator | ||
|
||
with DAG( | ||
'coincap_elt', | ||
description='A simple DAG to fetch data \ | ||
from CoinCap Exchanges API and write to a file', | ||
schedule_interval=timedelta(days=1), | ||
start_date=datetime(2023, 1, 1), | ||
catchup=False, | ||
) as dag: | ||
|
||
url = "https://api.coincap.io/v2/exchanges" | ||
file_path = f'{os.getenv("AIRFLOW_HOME")}/data/coincap_exchanges.csv' | ||
|
||
@task | ||
def fetch_coincap_exchanges(url, file_path): | ||
response = requests.get(url) | ||
data = response.json() | ||
exchanges = data['data'] | ||
if exchanges: | ||
keys = exchanges[0].keys() | ||
with open(file_path, 'w') as f: | ||
dict_writer = csv.DictWriter(f, fieldnames=keys) | ||
dict_writer.writeheader() | ||
dict_writer.writerows(exchanges) | ||
|
||
markdown_path = f'{os.getenv("AIRFLOW_HOME")}/visualization/' | ||
q_cmd = ( | ||
f'cd {markdown_path} && quarto render {markdown_path}/dashboard.qmd' | ||
) | ||
gen_dashboard = BashOperator( | ||
task_id="generate_dashboard", bash_command=q_cmd | ||
) | ||
|
||
fetch_coincap_exchanges(url, file_path) >> gen_dashboard |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.