This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# see the current limits | |
$ sysctl -a | grep maxproc | |
# increase it | |
$ sudo sysctl -w kern.maxproc=xxxx | |
$ sudo sysctl -w kern.maxprocperuid=xxx | |
# run at startup | |
$ sudo vim /etc/sysctl.conf |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
from sqlalchemy.exc import IntegrityError | |
from sqlalchemy.sql.expression import ClauseElement | |
def _get_or_create(session, model, defaults=None, **kwargs): | |
try: | |
query = session.query(model).filter_by(**kwargs) | |
instance = query.first() |