Skip to content

Instantly share code, notes, and snippets.

@kreczko
kreczko / run.py
Created September 28, 2021 19:15
FastAPI velocity check middleware
for route in app.routes:
if '/{' in route.path:
i = route.path.index('/{')
url_list.append(route.path[:i])
else:
url_list.append(route.path)
app.add_middleware(VelocityMiddleware, fast_track_paths=url_list)
@kreczko
kreczko / grid.py
Last active July 11, 2018 08:33
DMLIte SE consistency check
import gfal2
import os
fs = gfal2.creat_context()
def _ls(path):
try:
paths = fs.listdir(path)
return [os.path.join(path, p) for p in paths]
except: # p not a directory
diff --git a/tools/submit-pull-request b/tools/submit-pull-request
index 4ac99ce..c847484 100755
--- a/tools/submit-pull-request
+++ b/tools/submit-pull-request
@@ -8,7 +8,7 @@
#
# Authors:
# - Martin Barisits, <martin.barisits@cern.ch>, 2017
-
+from __future__ import print_function
gfal-copy -v srm://cit-se.ultralight.org:8443/srm/v2/server?SFN=/mnt/hadoop/store/mc/RunIISpring16DR80/ZprimeToWWToWlepWhad_width0p1_M-800_TuneCUETP8M1_13TeV-madgraph-pythia8/RAWAODSIM/PUSpring16RAWAODSIM_80X_mcRun2_asymptotic_2016_v3-v2/70000/8E3D3AED-2C20-E611-A0C6-002590D9DA9C.root gsiftp://lcgse01.phy.bris.ac.uk/dpm/phy.bris.ac.uk/home/cms/store/user/kreczko/test_caltech.root
Copying 2266696002 bytes srm://cit-se.ultralight.org:8443/srm/v2/server?SFN=/mnt/hadoop/store/mc/RunIISpring16DR80/ZprimeToWWToWlepWhad_width0p1_M-800_TuneCUETP8M1_13TeV-madgraph-pythia8/RAWAODSIM/PUSpring16RAWAODSIM_80X_mcRun2_asymptotic_2016_v3-v2/70000/8E3D3AED-2C20-E611-A0C6-002590D9DA9C.root => gsiftp://lcgse01.phy.bris.ac.uk/dpm/phy.bris.ac.uk/home/cms/store/user/kreczko/test_caltech.root
event: [1464688233915] BOTH GFAL2:CORE:COPY LIST:ENTER
event: [1464688233915] BOTH GFAL2:CORE:COPY LIST:ITEM srm://cit-se.ultralight.org:8443/srm/v2/server?SFN=/mnt/hadoop/store/mc/RunIISpring16DR80/ZprimeToWWToWlepWhad_width0p1_M-800_Tune
@kreczko
kreczko / common.yaml
Last active February 12, 2016 16:47
hiera with external facts
---
message: "This is our common yaml file"
classes:
- site
- 'profile::base'
@kreczko
kreczko / apelclient_output
Last active December 19, 2015 04:49
Apel client message
apelclient
2013-07-01 11:59:39,014 - client - INFO - Starting apel client version 1.1.0
2013-07-01 11:59:39,014 - client - INFO - Connecting to the database ...
2013-07-01 11:59:39,019 - apeldb - DEBUG - Cannot import oracle backend
2013-07-01 11:59:39,025 - apel.db.backends.mysql - INFO - Connected to localhost:3306
2013-07-01 11:59:39,025 - apel.db.backends.mysql - INFO - Database: apelclient; username: apel
2013-07-01 11:59:39,025 - client - INFO - Connected.
2013-07-01 11:59:39,025 - client - INFO - =====================
2013-07-01 11:59:39,025 - client - INFO - Starting spec updater.
2013-07-01 11:59:39,031 - apel.ldap.query - DEBUG - Found value in first query: 2323
@kreczko
kreczko / gist:5877191
Last active December 19, 2015 01:39
Code for exec with onlyif example
exec { 'create-apel-mysql-tables':
command => '/usr/bin/mysql --defaults-file=/root/.my.cnf apelclient < /usr/share/apel/client.sql',
require => [
File['/usr/share/apel/client.sql'],
Class["mysql"],
Class["mysql::server"],
Database[$mysql_database]],
# needs check if already exists, otherwise will wipe the tables!
onlyif => 'exit $(`/usr/bin/mysql --defaults-file=/root/.my.cnf -e "use apelclient; show tables;SELECT FOUND_ROWS();" 2>&1 | cut -f1 | egrep "^(0|[1-9][0-9]*)$"`)'
}
@kreczko
kreczko / AnalysisSoftware error log GCC 4.7
Created May 15, 2013 10:39
AnalysisSoftware error log GCC 4.7
>> Compiling  /automount/users/phgph/CMSSW_6_1_2/src/BristolAnalysis/Tools/bin/Analysis.cpp
In file included from /cvmfs/cms.cern.ch/slc5_amd64_gcc472/external/boost/1.51.0-cms2/include/boost/unordered/unordered_map.hpp:17:0,
                from /cvmfs/cms.cern.ch/slc5_amd64_gcc472/external/boost/1.51.0-cms2/include/boost/unordered_map.hpp:16,
                from /automount/users/phgph/CMSSW_6_1_2/src/BristolAnalysis/Tools/bin/Analysis.h:13,
                from /automount/users/phgph/CMSSW_6_1_2/src/BristolAnalysis/Tools/bin/Analysis.cpp:8:
/cvmfs/cms.cern.ch/slc5_amd64_gcc472/external/boost/1.51.0-cms2/include/boost/unordered/detail/equivalent.hpp: In copy constructor 'boost::unordered::detail::grouped_node<A, T>::grouped_node(const boost::unordered::detail::grouped_node<A, T>&)':
/cvmfs/cms.cern.ch/slc5_amd64_gcc472/external/boost/1.51.0-cms2/include/boost/unordered/detail/equivalent.hpp:54:25: error: there are no arguments to 'assert' that depend on a template parameter, so a declaration of 'assert'
Mar 26 18:16:34 vm-37-01 bcfg2-server[16929]: Error determining client probes
#012Traceback (most recent call last):
#012 File "/usr/lib/python2.6/site-packages/Bcfg2/Server/Core.py", line 385, in GetProbes
#012 meta = self.build_metadata(name)
#012 File "/usr/lib/python2.6/site-packages/Bcfg2/Server/Core.py", line 357, in build_metadata
#012 data = conn.get_additional_data(imd)
#012 File "/usr/lib/python2.6/site-packages/Bcfg2/Server/Plugins/Packages/__init__.py", line 269, in get_additional_data
#012 collection = self._get_collection(metadata)
#012 File "/usr/lib/python2.6/site-packages/Bcfg2/Server/Plugins/Packages/__init__.py", line 266, in _get_collection#012 debug=self.debug_flag)
#012 File "/usr/lib/python2.6/site-packages/Bcfg2/Server/Plugins/Packages/Collection.py", line 340, in factory