summaryrefslogtreecommitdiff
path: root/python/skytools/scripting.py
AgeCommit message (Collapse)Author
2011-11-08skytools.scripting: logging cleanupMarko Kreen
- allow different log format when logging verbosely - don't assign to self.log during __init__, instead use class var This allows subclass var to override self.log
2011-11-04skytools.dedent: new function for removing indentMarko Kreen
extract code from .print_ini and make usable elsewhere too.
2011-10-14skytools.scripting: make non-skylog logging attach to rootMarko Kreen
use_skylog logging was already doing it. Now that simple logging does it do, using self.log is not mandatory anymore, code can use 'logging' module directly. Also make console and logfile output configurable.
2011-10-04skytools.DBscript: set_database_defaults methodMarko Kreen
Mainly for simple way to set db mode across all get_database() calls.
2011-08-24Merge remote-tracking branch 'martino/master'Marko Kreen
2011-08-23scripting.py: added some aliases in BaseScriptmartinko
stat_add -> stat_put stat_inc -> stat_increase
2011-08-22skytools.BaseScript: fix attribute typo (cf_override)Marko Kreen
2011-08-22minor typos fixedmartinko
2011-07-04skytools.DBScript: drop connection if connect string has changedMarko Kreen
.reload() happens between .work() calls, so it's safe to drop connection on first .get_database()
2011-04-15skytools: Separate generic scripting from DBScriptMarko Kreen
2011-04-06Avoid direct symbol importsMarko Kreen
Always use import skytools def xx(): skytools.foo this allows maximum laziness when importing.
2011-02-09dbscript: make db service-api errors noiselessMarko Kreen
2011-01-24dbscript: debug log for new connectionsMarko Kreen
2011-01-17DBScript: allow override config parameters from command line (--set).Marko Kreen
2010-10-12use defa sklogMarko Kreen
2010-08-02Fix typo.Marko Kreen
2010-08-02Disable use_skylog if non-daemon on console.Marko Kreen
This avoids console commands to send errors/warnings to central logging server. Set use_skylog=2 to always enable.
2010-08-02DBScript: Wake from sleep on NOTIFY.Marko Kreen
Use DBScript .listen(dbname, chan)/.unlisten(dbname, chan) to register.
2010-07-26dnscript: avoid .rollback() when closing connection, its unnecessaryMarko Kreen
2009-12-03DBScript: move self.args check for config to load_config()Marko Kreen
This allows config-less scripts to override it.
2009-12-03DBScript.run_func_safely: stop playing with prefer_loopingMarko Kreen
Precalculating 'prefer_looping' does not work as the parameters may be changed inside called function.
2009-12-03DBscript.sleep(): wrapper around time.sleep()Marko Kreen
This will allow smarter handling of sleep time in the future. Eg. wake up on notice from db.
2009-12-03DBScript: quick exit on MemoryErrorMarko Kreen
2009-11-04DBScript: restore .looping variableMarko Kreen
loop_delay is loaded from conf, so it conflicts with .set_single_loop() in scripts which have both looping mode and non-looping mode. Eg: londiste, walmgr
2009-11-04DBScript: avoid second reload on startupMarko Kreen
2009-11-03DBScript: use log.exception also for psycopg errorsMarko Kreen
2009-10-14python/: Add --version switch to all scripts.Marko Kreen
Based on patch by Hannu Krosing
2009-10-14skytools.DBScript: safer pidfile writingMarko Kreen
- signal_pidfile: Clarify ValueError error message. Thrown usually on empty pidfiles, the error messega will now mention the pidfile name. - run_single_process: restructure pidfile writing, so that the pidfile is removed if .write() failed, but not when open() failed. This should avoid the chance that empty pidfiles are hanging around.
2009-09-21dbscript: rename connection_setup to connection_hookMarko Kreen
2009-09-21DBScript: Simplify looping and docstring handlingMarko Kreen
- looping: remove .do_single_loop and .looping variables, let only .loop_delay control looping. If loop_delay is missing from confing or 0, then instead sleep, the script will exit. - docstr: print docstring fragments recursively, so each class needs to only document its own parameters. - londiste.py: use Replicator class to print default config as it has proper class inheritance.
2009-09-10DBScript: exception_hookMarko Kreen
2009-09-09skytools.DBScript: make work_state = -1 signal exceptionMarko Kreen
If exception was thrown, set work_state = -1, to let consumer handle next work differently.
2009-06-01python scripts: Move template config to docstring.Asko Oja
* Template config is now in docstring to make to more easy to keep up-to-date. * dbscript: --ini option to show template config.
2009-06-01dbscript: better desc for -q/-vMarko Kreen
2009-05-06DBScript: bad argument reference in run_safelyMarko Kreen
2009-04-28DBScript: avoid double config reloadMarko Kreen
also remove pointless job_name default, as it is already handled in Config class.
2009-04-28scripting: unify exception handling, show db nameMarko Kreen
Have single place where exceptions are handled. psycopg attaches .cursor to each exception, use that to show connection name in error messages.
2009-03-05- bring londiste.ini up to dateMartin Pihlak
- bring londiste help message more up to date - add --help hint for DBScript start error msg - bump pgq version to 3.0devel
2009-02-17New UsageError exception class.Marko Kreen
When thrown, the DBScript will just print the error message, without traceback and any additional noise To be used to show user simple error messages. Can be used to build own Exception classes.
2009-02-13python/skytools updateMarko Kreen
- docstrings - some preliminary python 3.0 compat (var names, print()) - sync with 2.1-stable adminscript: - move exec_cmd function to dbscript dbstruct: - support sequnces. SERIAL columns are not automatically created, but the link beteween column and sequence is. psycopgwrapper: - drop support for psycopg1 - beginnings of quick DB-API / DictRow description. quoting: - new unquote_fqident() function, reverse of quote_fqident() - quote_statement() accepts both row and dict dbscript: - catch startup errors - use log.exception for exceptions, will result in nicer logs sqltools: - exists_sequence() _pyquoting: - fix typo in variable name
2009-01-08skytools.DBScript: better pidfile handling (from 2.2)Marko Kreen
2008-06-18DBScript.stat_add - keep the old function for compatMarko Kreen
2008-04-17forget db completely on close_database() to allow location changeMarko Kreen
2008-04-16fix more bugs - stats, trigger typeMarko Kreen
2008-04-15more setconsumer/londiste work.Marko Kreen
simple init/event processing/copy seems to work.
2008-02-28allow config-less operationMarko Kreen
2007-12-05DBScript: allow to specify exact connstr to get_database()Marko Kreen
2007-07-25skytools: docstring shuffle, hide/remove low-level/old stuffMarko Kreen
2007-07-23skytools: separate psycopg specific codeMarko Kreen
2007-07-16skytools: support for psycopg2Marko Kreen