Skip to content

Instantly share code, notes, and snippets.

@mvdbeek
mvdbeek / gunicorn_callbacks_for_worker_id.py
Created March 10, 2022 12:05 — forked from hynek/gunicorn_callbacks_for_worker_id.py
This is an attempt to emulate uWSGI’s uwsgi.worker_id() that ensures that I have worker IDs from 1…--workers which is useful in logging and instrumentation where changing PIDs are annoying.
import os
def on_starting(server):
"""
Attach a set of IDs that can be temporarily re-used.
Used on reloads when each worker exists twice.
"""
server._worker_id_overload = set()
@mvdbeek
mvdbeek / create_workflow_in_workflowhub.py
Last active July 22, 2020 15:16 — forked from stuzart/gist:603376877d3f7e3f1a284e314a0f171e
basic registering a workflow with workflow hub
import requests
import json
import string
import getpass
base_url = 'https://testing2.fair-dom.org'
containing_project_id = 1
token = ""