Skip to content

Commit

Permalink
Utiliza cliente explícito do prefect
Browse files Browse the repository at this point in the history
  • Loading branch information
bcbernardo committed May 12, 2023
1 parent 39de51f commit a5c5ae0
Showing 1 changed file with 23 additions and 13 deletions.
36 changes: 23 additions & 13 deletions implementar_fluxos.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,18 +48,26 @@
"http://127.0.0.1:4200/api",
)


logger.info("Configurando bloco de conexão com registro `{}`...", DOCKER_REGISTRO_URL)
bloco_docker_registro = DockerRegistry(
username=DOCKER_REGISTRO_USUARIO,
password=DOCKER_REGISTRO_SENHA,
registry_url=DOCKER_REGISTRO_URL,
reauth=True,
)
bloco_docker_registro.save(
name="docker-registro-impulso",
overwrite=True,
)

logger.info("Iniciando cliente bloco de conexão com registro `{}`...", DOCKER_REGISTRO_URL)
async with PrefectClient(api=PREFECT_API_URL) as cliente:
problemas_api = await cliente.api_healthcheck()
if problemas_api:
logger.error("Tentativa de estabelecer conexão com a API falhou: " + problemas_api.__repr__)
raise problemas_api

logger.info("Configurando bloco de conexão com registro `{}`...", DOCKER_REGISTRO_URL)
bloco_docker_registro = DockerRegistry(
username=DOCKER_REGISTRO_USUARIO,
password=DOCKER_REGISTRO_SENHA,
registry_url=DOCKER_REGISTRO_URL,
reauth=True,
)
await bloco_docker_registro.save(
name="docker-registro-impulso",
overwrite=True,
client=cliente,
)

logger.info("Configurando bloco de infraestrutura com Docker...")
bloco_docker_container = DockerContainer(
Expand All @@ -79,9 +87,10 @@
name="docker-container-impulsoetl",
stream_output=True,
)
bloco_docker_container.save(
await bloco_docker_container.save(
name="docker-container-impulsoetl",
overwrite=True,
client=cliente,
)

logger.info("Lendo módulos disponíveis...")
Expand Down Expand Up @@ -122,6 +131,7 @@
infrastructure=bloco_docker_container,
path=str(modulo_localizacao.parent),
version=impulsoetl_versao,
client=cliente,
)
if not implementacao.schedule:
implementacao.schedule = CronSchedule(
Expand Down

0 comments on commit a5c5ae0

Please sign in to comment.