Skip to content

Instantly share code, notes, and snippets.

View ulises's full-sized avatar

Ulises Cervino Beresi ulises

View GitHub Profile
@ulises
ulises / README.md
Created May 7, 2020 20:37 — forked from datagrok/README.md
What happens when you cancel a Jenkins job

When you cancel a Jenkins job

Unfinished draft; do not use until this notice is removed.

We were seeing some unexpected behavior in the processes that Jenkins launches when the Jenkins user clicks "cancel" on their job. Unexpected behaviors like:

  • apparently stale lockfiles and pidfiles
  • overlapping processes
  • jobs apparently ending without performing cleanup tasks
  • jobs continuing to run after being reported "aborted"

Keybase proof

I hereby claim:

To claim this, I am signing this object:

@ulises
ulises / walk_tree.py
Created April 2, 2019 10:53 — forked from woodsaj/walk_tree.py
Walk graphite metrics tree from specified prefix
#!/usr/bin/python
import requests
import json
import argparse
from Queue import Queue
from threading import Thread, Lock
import sys
import unicodedata
@ulises
ulises / README.md
Created April 1, 2017 22:08 — forked from metmajer/README.md
Ansible Logging To Elasticsearch

Ansible Logging To Elasticsearch

Turns Ansible log outputs into plain JSON strings and sends them to an Elasticsearch cluster.

Place the script in your playbook's plugins/callbacks/ directory.

@ulises
ulises / scriptrec.sh
Created April 27, 2016 07:21 — forked from hoehrmann/scriptrec.sh
Automatically record bash sessions
#####################################################################
#
# This script starts an automatically recorded session using `script`
# storing logs in `$log_dir`. Care should be taken to secure records
# generated by this script as they may easily contain passwords and
# other sensistive information.
#
#####################################################################
# FIXME(bh): make this configurable
nodes = resp.json()['nodes']
ret = []
for id, node in nodes.items():
node.update({'id': id})
ret.append(node)
return ret
# from http://codereview.stackexchange.com/questions/42802/a-non-blocking-lock-decorator-in-python
def non_blocking_lock(fn):
"""Decorator. Prevents the function from being called multiple times simultaneously.
If thread A is executing the function and thread B attempts to call the
function, thread B will immediately receive a return value of None instead.
"""
locks = defaultdict(Lock)
(import [flask [Flask]])
(def app (Flask "hy-flask"))
;; (import [app [views]])
(with-decorator (.route app "/")
(defn index [] "hello!"))
@app.route('/status/<runid>')
def testy_run_status(runid):
toasty_root = "/Users/ulises/development/testy/toasty"
print "Checking: " + runid
def read_status():
line = ""
with io.open(toasty_root + "/runs/" + str(runid), "r") as f:
while not summary.findall(line):
def run(exe):
p = Popen(exe, stdout=PIPE, stderr=STDOUT)
while(True):
retcode = p.poll() #returns None while subprocess is running
line = p.stdout.readline()
yield line
if(retcode is not None):
break