Skip to content

Commit

Permalink
added stuff to run tron locally
Browse files Browse the repository at this point in the history
  • Loading branch information
EmanElsaban committed Nov 1, 2023
1 parent 4a5f43a commit 6391297
Show file tree
Hide file tree
Showing 4 changed files with 97 additions and 63 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,13 @@ itest_%: debitest_%
@echo "itest $* OK"

dev:
SSH_AUTH_SOCK=$(SSH_AUTH_SOCK) .tox/py38/bin/trond --debug --working-dir=dev -l logging.conf --host=0.0.0.0
SSH_AUTH_SOCK=$(SSH_AUTH_SOCK) .tox/py38/bin/trond --debug --working-dir=dev -l logging.conf --host=0.0.0.0 --web-path=/nail/home/emanelsabban/pg/Tron/tronweb

example_cluster:
tox -e example-cluster

yelpy:
.tox/py38/bin/pip-custom-platform install -i https://pypi.yelpcorp.com/simple -r yelp_package/extra_requirements_yelp.txt
.tox/py38/bin/pip install -i https://pypi.yelpcorp.com/simple -r yelp_package/extra_requirements_yelp.txt

LAST_COMMIT_MSG = $(shell git log -1 --pretty=%B | sed -e 's/[\x27\x22]/\\\x27/g')
release:
Expand Down
148 changes: 89 additions & 59 deletions dev/config/MASTER.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
state_persistence:
name: "tron_state"
table_name: "tmp-tron-state"
store_type: "dynamodb"
store_type: "shelve"
buffer_size: 1
dynamodb_region: us-west-1

Expand All @@ -10,71 +10,101 @@ ssh_options:
agent: True

nodes:
- hostname: localhost

mesos_options:
master_address: mesos.paasta-mesosstage.yelp
master_port: 5050
role: '*'
enabled: True
dockercfg_location: file:///root/.dockercfg
- hostname: localhost
name: localhost
username: batch
- hostname: localhost
name: paasta
username: batch

k8s_options:
enabled: true
kubeconfig_path: /nail/home/emanelsabban/pg/Tron/tron.conf
# Replace this with the path relative to your home dir to use
# action_runner:
# runner_type: "subprocess"
# remote_status_path: "pg/tron/status"
# remote_exec_path: "pg/tron/.tox/py38/bin"

jobs:
testjob0:
enabled: true
node: localhost
schedule: "cron * * * * *"
run_limit: 5
actions:
zeroth:
command: env
trigger_downstreams:
minutely: "{ymdhm}"
cpus: 1
mem: 100

testjob1:
enabled: false
node: localhost
schedule: "cron * * * * *"
actions:
first:
command: "sleep 5"
cpus: 1
mem: 100
second:
command: "echo 'hello world'"
requires: [first]
triggered_by:
- "MASTER.testjob0.zeroth.minutely.{ymdhm}"
trigger_downstreams:
minutely: "{ymdhm}"
cpus: 1
mem: 100

testjob2:
enabled: false
node: localhost
schedule: "cron * * * * *"
actions:
first:
command: "echo 'goodbye, world'"
cpus: 1
mem: 100
triggered_by:
- "MASTER.testjob1.second.minutely.{ymdhm}"

retrier:
node: localhost
schedule: "cron 0 0 1 1 *"
k8s:
actions:
failing:
command: exit 1
sleep:
annotations:
paasta.yelp.com/routable_ip: 'false'
cap_add: []
cap_drop:
- SETPCAP
- MKNOD
- AUDIT_WRITE
- CHOWN
- NET_RAW
- DAC_OVERRIDE
- FOWNER
- FSETID
- KILL
- SETGID
- SETUID
- NET_BIND_SERVICE
- SYS_CHROOT
- SETFCAP
command: sleep 60; echo "I'm up and running $PAASTA_DOCKER_IMAGE"
cpus: 0.1
disk: 1024
docker_image: docker-paasta.yelpcorp.com:443/services-paasta-contract-monitor:paasta-a0c12fd6fbce6707947ce1fafcfdf7a7c6aaff9d
env:
ENABLE_PER_INSTANCE_LOGSPOUT: '1'
PAASTA_CLUSTER: infrastage
PAASTA_DEPLOY_GROUP: everything
PAASTA_DOCKER_IMAGE: services-paasta-contract-monitor:paasta-a0c12fd6fbce6707947ce1fafcfdf7a7c6aaff9d
PAASTA_GIT_SHA: a0c12fd6
PAASTA_INSTANCE: k8s.sleep
PAASTA_INSTANCE_TYPE: tron
PAASTA_MONITORING_TEAM: compute_infra
PAASTA_RESOURCE_CPUS: '0.1'
PAASTA_RESOURCE_DISK: '1024'
PAASTA_RESOURCE_MEM: '50'
PAASTA_SERVICE: paasta-contract-monitor
executor: kubernetes
extra_volumes: []
field_selector_env:
PAASTA_POD_IP:
field_path: status.podIP
labels:
paasta.yelp.com/cluster: infrastage
paasta.yelp.com/instance: k8s.sleep
paasta.yelp.com/pool: default
paasta.yelp.com/service: paasta-contract-monitor
yelp.com/owner: compute_infra_platform_experience
mem: 50
node_selectors:
yelp.com/pool: default
retries: 1
retries_delay: 5m
secret_env:
PAASTA_SECRET_TEST:
key: goss
secret_name: tron-secret-paasta-contract-monitor-goss
secret_volumes:
- container_path: /super-secret-data
items:
- key: goss
path: secret.py
secret_name: goss
secret_volume_name: tron-secret-paasta-contract-monitor-goss
service_account_name: paasta--arn-aws-iam-528741615426-role-paasta-contract-monitor
node: paasta
queueing: false
monitoring:
alert_after: 25m
description: k8s actions failing on Tron locally
page: false
runbook: http://y/rb-tron
slack_channels:
- emans-super-cool-channel
team: noop
ticket: false
tip: Check "paasta logs" and read y/rb-paasta-contract-monitor
schedule:
type: cron
value: '*/1 * * * *'
use_k8s: true
2 changes: 0 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
[tox]
envlist = py38
tox_pip_extensions_ext_pip_custom_platform = true
tox_pip_extensions_ext_venv_update = true

[testenv]
basepython = python3.8
Expand Down
6 changes: 6 additions & 0 deletions tron/config/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,12 @@ def _asdict(self) -> dict:
d = super()._asdict().copy()
items = d.get("items", [])
if items is not None and items:
# the config parsing code appears to be turning arrays into tuples - however, updating the
# code we think is at fault breaks a non-trivial amount of tests. in the interest of time, we're
# just casting to a list here, but we should eventually circle back here
# and either ensure that we always get a list from the config parse code OR document that we're
# expecting Tron's config parsing code to return immutable data if this is behavior we want to depend on.
d["items"] = list(d["items"])
for i, item in enumerate(items):
if isinstance(item, ConfigSecretVolumeItem):
d["items"][i] = item._asdict()
Expand Down

0 comments on commit 6391297

Please sign in to comment.