def RenderJob(name='No Name', command = 'printf "Frame: %4s %s\n" $WRANGLER_FRAME $WRANGLER_PADFRAME', start=1, end=100, step=1, padding=4, priority=500, env=None, owner=None, **meta): config = config_base() if not env: env = {} env = update_env(env) if not owner: owner = os.environ['USER'] job = Job(name, env=env) job.owner = owner for i in range(start, end + 1, step): task = Task(command) task.env.update(env) task.env['WRANGLER_PADFRAME'] = str(i).zfill(padding) task.env['WRANGLER_FRAME'] = i task.priority = priority job.tasks.append(task) job.status = job.WAITING return job
def __init__(self, hostname=None, port=None): config = config_base() if not port: port = config.getint('cattle', 'port') if not hostname: hostname = info.hostname() WranglerClient.__init__(self, hostname, port)
def __init__(self, hostname=None, port=None): self.config = config_base() if not hostname: hostname = self.config.get('lasso', 'hostname') if not port: port = self.config.getint('lasso', 'port') log.debug('Starting client to %s:%d' % (hostname, port)) self.client = ServerProxy('http://%s:%s' % (hostname, port), allow_none=True)
def update_env(env): run_env = {}#os.environ.copy() env_mask = config_base().get('jobs', 'env-mask').split(':') for mask in env_mask: try: del env[mask] except KeyError: pass run_env.update(env) return run_env
def configure(self): self.config = config_base()
#!/usr/bin/env python import os from wrangler.config import config_base from wrangler.db.core import * config = config_base() class TaskLog(Base): __tablename__ = 'task_logs' id = Column(Integer, primary_key=True) task_id = Column(Integer, ForeignKey('tasks.id')) time = Column(Float, default=-1) returncode = Column(Integer, default=2) cattle_id = Column(Integer, ForeignKey('cattles.id')) cattle = relation('Cattle', backref=backref('logs')) stdout = Column(String(256)) stderr = Column(String(256)) logdir = os.path.expandvars(config.get('logging', 'task-dir')) def __init__(self, task, cattle): self.task_id = task.id self.cattle_id = cattle.id self.stdout = self._stdout_file_path() self.stderr = self._stderr_file_path() def _stdout_file_path(self):