This file contains hidden or 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
from typing import Iterable, Callable | |
from logging import getLogger, Logger | |
import functools | |
def log_method_call_if_error(*loggers: Iterable[Logger]): | |
if len(loggers) == 0: | |
loggers = (getLogger("root"),) | |
def decorator(func): |
This file contains hidden or 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
#__main__.py | |
import pulumi | |
from helper import prov_firewall, prov_network, prov_instance, prov_address | |
MACHINE_NAMES = ["controle-plane", "worker-1", "worker-2", "load-balancer"] | |
network = prov_network(network_name="default-network") | |
firewall = prov_firewall(network=network, firewall_name="default-firewall") |
This file contains hidden or 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
import pulumi | |
from helper import prov_firewall, prov_network, prov_instance, prov_address | |
MACHINE_NAMES = ["controle-plane", "worker-1", "worker-2", "load-balancer"] | |
network = prov_network(network_name="default-network") | |
firewall = prov_firewall(network=network, firewall_name="default-firewall") | |
This file contains hidden or 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
apiVersion: v1 | |
metadata: | |
name: envs-config | |
data: | |
MUL_HOST: svc-mul | |
MUL_PORT: "8001" | |
SUM_HOST: svc-sum | |
SUM_PORT: "8002" | |
kind: ConfigMap |
This file contains hidden or 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
apiVersion: apps/v1 | |
kind: Deployment | |
metadata: | |
labels: | |
app: ms-sum | |
name: ms-sum | |
spec: | |
replicas: 1 | |
selector: | |
matchLabels: |
This file contains hidden or 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
apiVersion: apps/v1 | |
kind: Deployment | |
metadata: | |
labels: | |
app: ms-mul | |
name: ms-mul | |
spec: | |
replicas: 1 | |
selector: | |
matchLabels: |
This file contains hidden or 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
apiVersion: apps/v1 | |
kind: Deployment | |
metadata: | |
labels: | |
app: ms-master | |
name: ms-master | |
spec: | |
replicas: 1 | |
selector: | |
matchLabels: |
This file contains hidden or 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
x-back-env-file: &back-env-file | |
- configmaps/pyenvs/local.env | |
version: "3.9" # optional since v1.27.0 | |
services: | |
py_worker: | |
image: py_worker | |
env_file: *back-env-file | |
depends_on: | |
- redisq |
This file contains hidden or 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
// worker.js | |
import celery from "celery-node"; | |
import celeryConfig from './config.js' | |
import {add} from './tasks/example/arithmetic.js' | |
const worker = celery.createWorker( | |
celeryConfig.BROKER_URL, | |
celeryConfig.CELERY_RESULT_BACKEND, |
This file contains hidden or 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
# worker.py | |
from py_workers.config import CeleryConfig | |
from celery import Celery | |
celery_app = Celery( | |
main=CeleryConfig.APP_NAME, | |
backend=CeleryConfig.CELERY_RESULT_BACKEND, | |
broker=CeleryConfig.BROKER_URL, | |
include=[ | |
"py_workers.tasks.example.arithmetic", |
NewerOlder