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 / README.md
Last active February 17, 2025 09:31
KIT Tier 1 AUDITOR-APEL v0.6.3 configuration

KIT Tier 1 AUDITOR-APEL v0.6.3 configuration

This is a simple configuration to have AUDITOR act as an APEL client for HTCondor. In this setup the entire AUDITOR+APEL chain runs a separate instance directly on each CE. You also need to configure the AUDITOR core and its PostgreSQL database.

If you want to run the toolchain from a different host (say the Condor Negotiator), adjust the schedd_names to cover all the condor submit nodes / CEs. If you want to support subsites, adjust the various site entries in both configurations.

@maxfischer2781
maxfischer2781 / record_job.py
Created December 18, 2024 09:42
Tool for recording HTCondor job information from an execution point slot
from typing import Iterable, NamedTuple
import argparse
from pathlib import Path
import re
import socket
import subprocess
import time
CLI = argparse.ArgumentParser()
CLI.add_argument("SLOT", help=r"slot identifier as \d+_\d+")
@maxfischer2781
maxfischer2781 / apel-gap-publish.py
Created July 13, 2023 16:15
APEL gap publish CLI
#!/usr/bin/python3
from typing import Generator
import argparse
import configparser
import contextlib
import datetime
import pathlib
import tempfile
import subprocess
@maxfischer2781
maxfischer2781 / apel.diff
Created May 11, 2023 13:46
APEL HEPScore23 Patch
diff -cB --recursive production/usr/lib/python2.7/site-packages/apel/db/__init__.py patched/usr/lib/python2.7/site-packages/apel/db/__init__.py
*** production/usr/lib/python2.7/site-packages/apel/db/__init__.py 2021-03-22 17:42:15.000000000 +0100
--- patched/usr/lib/python2.7/site-packages/apel/db/__init__.py 2023-04-05 10:39:54.000000000 +0200
***************
*** 15,21 ****
'''
LOGGER_ID = "apeldb"
! JOB_MSG_HEADER = "APEL-individual-job-message: v0.3"
SUMMARY_MSG_HEADER = "APEL-summary-job-message: v0.2"
@maxfischer2781
maxfischer2781 / except_delete.py
Created February 28, 2022 16:48
Demonstrator for except clause deleting its target
v = "Hello World"
def scope():
global v
try:
1/0
except ZeroDivisionError as v:
pass
print(v)
@maxfischer2781
maxfischer2781 / slot_lookup.py
Created January 11, 2022 09:25
Draft for special method lookup
def slot_get(ob: object, field: str):
tp = type(ob)
try:
field = tp.__dict__[field]
except KeyError:
return getattr(super(tp, ob), field)
else:
try:
descriptor_get = field.__get__
except AttributeError:
@maxfischer2781
maxfischer2781 / gather_overhead.py
Created October 27, 2021 11:31
Script for measuring the overhead of asyncio.gather
import asyncio
import time
async def no_op():
return
async def main_gather(count):
await asyncio.gather(*(asyncio.gather(no_op()) for _ in range(count)))
@maxfischer2781
maxfischer2781 / base_playground.py
Last active October 14, 2021 07:43
Simple Physics Notation to Quantum Circuit example
# Measuring < 00 | X | 00 >, < 01 | X | 00 >, < 10 | X | 00 >, < 11 | X_0 | 00 >
from qiskit import QuantumCircuit
from qiskit.providers.aer import QasmSimulator
import time
# Use Aer's qasm_simulator
simulator = QasmSimulator()
# Circuit setup
circuit = QuantumCircuit(2) # |00>
@maxfischer2781
maxfischer2781 / decosample.py
Last active August 30, 2021 11:52
Helper that allows using the same decorator for both functions and methods
"""
Basic "Decoscriptor" example
"""
from decoscriptor import anydeco
@anydeco
def art(fun, *args, **kwargs):
print("Big Whoop and a bottle of", args, kwargs)
print("Fun is set to", getattr(fun, "__self__", "<unbound>"))
return fun(*args, **kwargs)
@maxfischer2781
maxfischer2781 / context_average.py
Created July 7, 2021 17:36
Use a context manager to average over several method calls
from contextlib import contextmanager
class Optimizer:
def __init__(self, weight: int):
self.weight = weight
def step(self, num):
num = self.calculate(num)
return self.apply(num)