Skip to content

Instantly share code, notes, and snippets.

View amaltaro's full-sized avatar

Alan Malta Rodrigues amaltaro

  • University of Notre Dame du Lac, CERN-CMS
  • United States
View GitHub Profile
0. Define environment variables to hold dummy user/pass and remote host name
$ USERPASS=cmst1:passwd
$ REMOTEHOST=alanblah.blah.ch
1. Checking status of remote CouchDB (running with Erlang R16B03)
$ curl -ks --cert $X509_USER_CERT --key $X509_USER_KEY "https://$REMOTEHOST/couchdb/"
{"couchdb":"Welcome","uuid":"50f495ef9a2090ec6dcb8f1543cab70d","version":"1.6.1","vendor":{"version":"1.6.1","name":"The Apache Software Foundation"}}
2. Checking status of local CouchDB (running with Erlang 22.3.4.19)
$ curl http://localhost:5984/
@amaltaro
amaltaro / fixDatasetParentage.py
Created May 25, 2020 19:59
multi-threading script to fix the StepChain parentage
#!/usr/bin/env python
"""
This script is supposed to perform the same action as this ReqMgr2 CherryPy thread:
https://github.com/dmwm/WMCore/blob/master/src/python/WMCore/ReqMgr/CherryPyThreads/StepChainParentageFixTask.py
so, given a child dataset name, it finds out all the run/lumi pairs, map them against
its parent dataset, and insert that information into DBS
"""
from __future__ import print_function, division
@amaltaro
amaltaro / testMemoryCache.py
Created November 28, 2019 12:07
Test MemoryCacheStruct for datatier validation
#!/usr/bin/env python
from __future__ import print_function
import time
from WMCore.Cache.GenericDataCache import GenericDataCache, MemoryCacheStruct
from WMCore.Services.DBS.DBS3Reader import DBS3Reader as DBSReader
def validateDatatier(datatier, dbsUrl, expiration=5):
cacheName = "dataTierList"
print("validateDatatier called with: %s" % dbsUrl)
@amaltaro
amaltaro / timeBindConversion
Last active May 20, 2019 13:05
Profiling DB bind conversion from unicode to byte string
#!/usr/bin/env python
from __future__ import print_function
import copy
import timeit
def convertBinds(bindsList, encodeType="ascii"):
for item in bindsList:
for k in item:
@amaltaro
amaltaro / transferor_format.json
Last active August 19, 2019 13:03
Data structure for the MS Transferor document
# OPTION A:
{"wf_A": {"timestamp": 0000
"primary": ["list of transfer ids"],
"secondary": ["list of transfer ids"]},
"wf_B": {"timestamp": 0000
"primary": [],
"secondary": []},
}
# OPTION B: