Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

initial commit #505

Closed
wants to merge 20 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
770000c
initial commit
ThiagoTrabach Sep 12, 2023
acf7c9b
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 12, 2023
0e18fdd
Merge branch 'master' into staging/sms-check-ip-address
mergify[bot] Sep 12, 2023
f29ff49
remove init
ThiagoTrabach Sep 12, 2023
5fccc6f
fix flow
ThiagoTrabach Sep 12, 2023
6164a76
wip
ThiagoTrabach Sep 12, 2023
b70bcb4
Merge branch 'master' into staging/sms-check-ip-address
mergify[bot] Sep 12, 2023
2f0c40f
Merge branch 'master' into staging/sms-check-ip-address
mergify[bot] Sep 15, 2023
329710c
Merge branch 'master' into staging/sms-check-ip-address
mergify[bot] Sep 16, 2023
a18bf3c
Merge branch 'master' into staging/sms-check-ip-address
mergify[bot] Sep 18, 2023
7c95ce8
Merge branch 'master' into staging/sms-check-ip-address
mergify[bot] Sep 19, 2023
e317b3c
Merge branch 'master' into staging/sms-check-ip-address
mergify[bot] Oct 23, 2023
1ea4b8c
Merge branch 'master' into staging/sms-check-ip-address
mergify[bot] Oct 23, 2023
7cde3b4
Merge branch 'master' into staging/sms-check-ip-address
mergify[bot] Oct 23, 2023
31d4d63
Merge branch 'master' into staging/sms-check-ip-address
mergify[bot] Oct 24, 2023
f64bf95
Merge branch 'master' into staging/sms-check-ip-address
mergify[bot] Oct 24, 2023
4354eae
Merge branch 'master' into staging/sms-check-ip-address
mergify[bot] Oct 24, 2023
d5c8112
Merge branch 'master' into staging/sms-check-ip-address
mergify[bot] Oct 26, 2023
4e25ba4
Merge branch 'master' into staging/sms-check-ip-address
mergify[bot] Oct 27, 2023
f96782d
Merge branch 'master' into staging/sms-check-ip-address
mergify[bot] Oct 27, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pipelines/rj_sms/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@

from pipelines.rj_sms.dump_db_sivep.flows import *
from pipelines.rj_sms.pubsub.flows import *
from pipelines.rj_sms.check_ip.flows import *
21 changes: 21 additions & 0 deletions pipelines/rj_sms/check_ip/flows.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# -*- coding: utf-8 -*-
from pipelines.utils.decorators import Flow
from pipelines.constants import constants
from prefect.run_configs import KubernetesRun
from prefect.storage import GCS
from pipelines.rj_sms.check_ip.tasks import get_public_ip

with Flow(
name="SMS: Check IP - Verifica ip do cluster", code_owners=["thiago"]
) as check_ip:
# Start run
download_task = get_public_ip()


check_ip.storage = GCS(constants.GCS_FLOWS_BUCKET.value)
check_ip.run_config = KubernetesRun(
image=constants.DOCKER_IMAGE.value,
labels=[
constants.RJ_SMS_DEV_AGENT_LABEL.value,
],
)
21 changes: 21 additions & 0 deletions pipelines/rj_sms/check_ip/tasks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# -*- coding: utf-8 -*-
import requests
from prefect import task
from pipelines.utils.utils import log


@task
def get_public_ip():
try:
# Use a public IP address API to fetch your IP address
response = requests.get("https://api64.ipify.org?format=json")

if response.status_code == 200:
data = response.json()
log(f"IP: {data['ip']}")
else:
log(f"Failed to retrieve IP address. Status Code: {response.status_code}")
except Exception as e:
log(f"An error occurred: {str(e)}")

return None
5 changes: 5 additions & 0 deletions pipelines/rj_sms/run.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# -*- coding: utf-8 -*-
from pipelines.rj_sms.check_ip.flows import check_ip
from pipelines.utils.utils import run_local

run_local(check_ip)
Loading