Skip to content

Instantly share code, notes, and snippets.

View maxfischer2781's full-sized avatar

Max Kühn maxfischer2781

  • Karlsruhe, Germany
View GitHub Profile
@maxfischer2781
maxfischer2781 / htc_exit_hook.py
Created September 23, 2016 14:23
Hook for HTCondor job_router that removes its job from a route
#!/usr/bin/python
from __future__ import print_function, with_statement
import sys
import ast
import subprocess
import time
route_test_performed, want_route_test = False, False
# read input so router does not stall
import argparse
from matplotlib import pyplot
from dengraph import dengraph
from dengraph.graphs import graph_io
CLI = argparse.ArgumentParser()
CLI.add_argument('--csv', help='csv inout file')
CLI.add_argument('-d', '--distance', help='maximum distance between nodes', default=1, type=float)
CLI.add_argument('-n', '--neighbours', help='neighbours required for cores', default=5, type=float)
@maxfischer2781
maxfischer2781 / multi_json.py
Created March 30, 2017 10:24
Parse multiple jsons from one input blob
import json
test_json = """\
[
1,
2,
3
]
[
@maxfischer2781
maxfischer2781 / xrd_crawl.py
Last active April 29, 2017 08:28
crawler for ALICE xrootd namespaces
from __future__ import print_function
import subprocess
import os
import argparse
import ast
import multiprocessing
import sys
import threading
import errno
@maxfischer2781
maxfischer2781 / alice-migration.sh
Last active August 3, 2017 12:21
Script to launch a migration of an XROOTD namespace conforming to the ALICE VO conventions
NAMESPACE=${NAMESPACE:-"/export/xrootd/"}
RSYNC_ADDR=${RSYNC_ADDR:-"rsync://f01-120-179/alice-xrootd/"}
NS_START=${NS_START:-"00"}
NS_STOP=${NS_STOP:-"15"}
#!/bin/bash
if [[ "$*" =~ " -h" ]] || [[ "$*" =~ ^-h ]] || [[ "$*" =~ "--help" ]]
then
echo "usage:" >&2
echo " <script> [NAMESPACE [RSYNC_ADDR [NS_START NS_STOP]]]" >&2
echo "" >&2
@maxfischer2781
maxfischer2781 / compile_whitelist.py
Last active February 6, 2018 17:16
Transform an ALICE catalogue dump to a hierarchy of whitelists
#!/usr/local/bin/python3
import argparse
import chainlet
from chainlet.concurrency import threads
import pickle
import os
import time
import datetime
CLI = argparse.ArgumentParser("Transform an ALICE catalogue dump to a hierarchy of whitelists")
@maxfischer2781
maxfischer2781 / condor_anon_stat.py
Created December 15, 2017 14:41
Anonymization for job statistics from HTCondor
#!/usr/bin/python
import sys
import json
import random
import time
import argparse
import hashlib
def load_data(source):
@maxfischer2781
maxfischer2781 / compare_whitelist.py
Created February 9, 2018 13:30
Compare an ALICE namespace to a catalogue whitelist
#!/usr/local/bin/python3
import os
import argparse
import pickle
import time
from typing import Set, Iterable
import chainlet
from chainlet.concurrency import threads
@maxfischer2781
maxfischer2781 / condor_usage.py
Last active July 4, 2018 08:26
extract user resource request data from condor_history
import os
import chainlet
import subprocess
import hashlib
import sys
import collections
from chainlet.protolink import iterlet
@maxfischer2781
maxfischer2781 / reify.py
Created June 16, 2018 19:02
relative map based on abstract operations
#!/usr/bin/python3
"""
Draft for a relative ``map`` based on abstract operations
.. function:: map(function, iterable, ...)
.. function:: reify(operation, iterable)
Apply the relative ``operation`` to every element of ``iterable``.
For example, ``reify(relative[0], [(1, 2, 3), range(5), "foobar"])`` returns ``[1, 0, 'f']``.