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

chore: add sandbox flow #19

Open
wants to merge 15 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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/exemplo/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# -*- coding: utf-8 -*-
from pipelines.exemplo.nome_do_objetivo.flows import * # noqa
from pipelines.exemplo.objetivo2.flows import * # noqa
Empty file.
28 changes: 28 additions & 0 deletions pipelines/exemplo/objetivo2/flows.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# -*- coding: utf-8 -*-
from prefect import Parameter
from prefect.run_configs import KubernetesRun
from prefect.storage import GCS
from prefeitura_rio.pipelines_utils.custom import Flow
from prefeitura_rio.pipelines_utils.state_handlers import handler_inject_bd_credentials

from pipelines.constants import constants
from pipelines.exemplo.objetivo2.tasks import hello_someone

with Flow(
name="SANDBOX",
state_handlers=[handler_inject_bd_credentials],
skip_if_running=True,
parallelism=5,
) as rj_escritorio__exemplo__objetivo2__flow:
# Parameters
name = Parameter("name", default="world")

# Flow
hello_someone(name=name)


rj_escritorio__exemplo__objetivo2__flow.storage = GCS(constants.GCS_FLOWS_BUCKET.value)
rj_escritorio__exemplo__objetivo2__flow.run_config = KubernetesRun(
image=constants.DOCKER_IMAGE.value,
labels=[constants.RJ_ESCRITORIO_AGENT_LABEL.value],
)
8 changes: 8 additions & 0 deletions pipelines/exemplo/objetivo2/tasks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# -*- coding: utf-8 -*-
from prefect import task
from prefeitura_rio.pipelines_utils.logging import log


@task
def hello_someone(name: str) -> None:
log(f"Hello, {name}!", "info")
Loading