Use a lock across python processes or threads.
Based on sqlite/sqlalchemy implementation. Tested on python 3.4+
.
To see how it works launch process.py
multiple times.
#!powershell | |
# | |
# powershell -ExecutionPolicy Bypass -File .\scripts\build_windows.ps1 | |
# | |
# gcloud auth application-default login | |
$ErrorActionPreference = "Stop" | |
function checkEnv() { | |
if ($null -ne $env:ARCH ) { |
INSTALL_DIR=/usr/local/flexlm/licenses | |
#get hostname from license file | |
licensed_hostname=$(shell cat license.dat | grep ^SERVER | awk '{print $$2}') | |
licensed_macaddr=$(shell cat license.dat | grep ^SERVER | awk '{print $$3}' | sed -e 's/../\0:/g' -e 's/:$$//' ) | |
help: | |
# Usage: | |
# make install # install license server | |
# make uninstall # uninstall license server |
#!/usr/bin/env python2 | |
# The script to parse a lmgrd log and give some license usage metrics | |
# | |
# Copyright (c) 2014 Grigory Rechistov <[email protected]> | |
# All rights reserved. | |
# | |
# Redistribution and use in source and binary forms, with or without | |
# modification, are permitted provided that the following conditions are met: | |
# | |
# 1. Redistributions of source code must retain the above copyright notice, |
# Dump schema from table | |
""" | |
Credit to Wilfredo Sánchez Vega who posted this answer | |
on stackoverflow | |
https://stackoverflow.com/questions/11996394/is-there-a-way-to-get-a-schema-of-a-database-from-within-python | |
""" | |
import sqlite3 | |
import re | |
import os | |
from pathlib import Path |
import sqlite3 | |
from utils import log | |
db_path = 'model.sqlite' | |
conn = sqlite3.connect(db_path) | |
class Model(object): | |
fields = [ |
# Use it like this: | |
# | |
# structlog.configure( | |
# processors=[ | |
# structlog.processors.JSONRenderer(), | |
# LogToSqlite("/tmp/logs.db") | |
# ] | |
# ) | |
# log = structlog.get_logger() | |
# log.msg("say-hello", whom="world", num=[random.randint(1,55)]) |
import os | |
import sqlite3 | |
import json | |
from biothings import config | |
from biothings.utils.hub_db import IDatabase | |
from biothings.utils.dotfield import parse_dot_fields | |
from biothings.utils.dataload import update_dict_recur | |
from biothings.utils.common import json_serial |
import json | |
import sqlite3 | |
repodata = json.load(open("497deca9.json")) | |
COLS = 'filename, build, build_number, depends, license, license_family, md5, name, sha256, size, subdir, timestamp, version'.split(', ') | |
db = sqlite3.connect("497deca9.sqlite") | |
db.execute("create table repodata ({}, primary key (filename))".format(','.join(COLS))) |
import llm | |
import sqlite_utils | |
import numpy as np | |
from scipy.cluster.hierarchy import linkage, cut_tree | |
from collections import defaultdict | |
collection_path = "your path here" | |
db = sqlite_utils.Database(collection_path) | |
collection = llm.Collection("pocket", db, create=False) |