def get_job_config(self): return AuroraConfig(job=Job( cluster='west', role='bozo', environment='test', name='the_job', service=False, task=Task(name='task', processes=[Process(cmdline='ls -la', name='process')], resources=Resources( cpu=1.0, ram=1024 * MB, disk=1024 * MB)), contact='*****@*****.**', instances=3, cron_schedule='* * * * *'))
def get_job_config(self, is_cron=False): return AuroraConfig(job=Job( cluster='west', role='bozo', environment='test', name='the_job', service=True if not is_cron else False, cron_schedule='* * * * *' if is_cron else Empty, task=Task(name='task', processes=[Process(cmdline='ls -la', name='process')], resources=Resources( cpu=1.0, ram=1024 * MB, disk=1024 * MB)), instances=3, ))
def task(cls): cmdline = 'head -c %d /dev/zero >&%d' % (cls.log_size().as_(Data.BYTES), cls.log_fd()) opt_config_process = Process(name=cls._OPT_CONFIG_PROCESS_NAME, cmdline=cmdline) custom_config_process = Process(name=cls._CUSTOM_CONFIG_PROCESS_NAME, cmdline=cmdline) custom_config = cls.custom_config() if custom_config: logger = Logger() if custom_config.destination: logger = logger(destination=custom_config.destination) if custom_config.mode: logger = logger(mode=custom_config.mode) if custom_config.size_mb or custom_config.backups: rotate = RotatePolicy() if custom_config.size_mb: rotate = rotate(log_size=custom_config.size_mb) if custom_config.backups: rotate = rotate(backups=custom_config.backups) logger = logger(rotate=rotate) custom_config_process = custom_config_process(logger=logger) return Task(name='log-config-task', processes=[opt_config_process, custom_config_process])