oio.event package

Submodules

oio.event.agent module

exception oio.event.agent.HaltServer(reason, exit_status=1)[source]

Bases: exceptions.BaseException

class oio.event.agent.Runner(conf_file, worker_class, **kwargs)[source]

Bases: object

SIGNALS = [1, 3, 2, 15]
SIG_NAMES = {1: 'hup', 2: 'int', 3: 'quit', 4: 'ill', 5: 'trap', 6: 'iot', 7: 'bus', 8: 'fpe', 9: 'kill', 10: 'usr1', 11: 'segv', 12: 'usr2', 13: 'pipe', 14: 'alrm', 15: 'term', 17: 'cld', 18: 'cont', 19: 'stop', 20: 'tstp', 21: 'ttin', 22: 'ttou', 23: 'urg', 24: 'xcpu', 25: 'xfsz', 26: 'vtalrm', 27: 'prof', 28: 'winch', 29: 'poll', 30: 'pwr', 31: 'sys', 34: 'rtmin', 64: 'rtmax'}
WORKER_START_ERROR = 3
configure_signals()[source]
halt(reason=None, exit_status=0)[source]
handle_chld(sig, frame)[source]
handle_hup()[source]
handle_int()[source]
handle_quit()[source]
handle_term()[source]
kill_worker(pid, sig)[source]
kill_workers(sig)[source]
manage_workers()[source]
reap_workers()[source]
run()[source]
signal(sig, frame)[source]
spawn_worker()[source]
spawn_workers()[source]
start()[source]
stop(graceful=True)[source]
x = 'TERM'
oio.event.agent.validate_msg(msg)[source]

oio.event.beanstalk module

class oio.event.beanstalk.BaseParser(socket_read_size)[source]

Bases: object

can_read()[source]
on_connect(connection)[source]
on_disconnect()[source]
read(size)[source]
read_response()[source]
class oio.event.beanstalk.Beanstalk(host=None, port=None, socket_timeout=None, socket_connect_timeout=None, socket_keepalive=None, retry_on_timeout=False, socket_keepalive_options=None, max_connections=None, connection=None)[source]

Bases: object

EXPECTED_ERR = {'bury': ['NOT_FOUND', 'OUT_OF_MEMORY'], 'delete': ['NOT_FOUND'], 'kick': ['OUT_OF_MEMORY'], 'kick-job': ['NOT_FOUND', 'OUT_OF_MEMORY'], 'put': ['JOB_TOO_BIG', 'BURIED', 'DRAINING', 'OUT_OF_MEMORY'], 'release': ['BURIED', 'NOT_FOUND', 'OUT_OF_MEMORY'], 'reserve': ['DEADLINE_SOON', 'TIMED_OUT'], 'reserve-with-timeout': ['DEADLINE_SOON', 'TIMED_OUT'], 'stats-tube': ['NOT_FOUND'], 'use': [], 'watch': []}
EXPECTED_OK = {'bury': ['BURIED'], 'delete': ['DELETED'], 'kick': ['KICKED'], 'kick-job': ['KICKED'], 'put': ['INSERTED'], 'release': ['RELEASED'], 'reserve': ['RESERVED'], 'reserve-with-timeout': ['RESERVED'], 'stats-tube': ['OK'], 'use': ['USING'], 'watch': ['WATCHING']}
RESPONSE_CALLBACKS = {'reserve': <function parse_body at 0x7fe74b7aad70>, 'reserve-with-timeout': <function parse_body at 0x7fe74b7aad70>, 'stats-tube': <function parse_yaml at 0x7fe74b7aacf8>}
bury(job_id, priority=2147483648)[source]
close()[source]
delete(job_id)[source]
drain_tube(tube)[source]

Delete all jobs from the specified tube.

execute_command(*args, **kwargs)[source]
classmethod from_url(url, **kwargs)[source]
kick(bound=1000)[source]

Move jobs into the ready queue. If there are any buried jobs, it will only kick buried jobs. Otherwise it will kick delayed jobs.

Parameters:bound (int) – upper bound on the number of jobs to kick
kick_job(job_id)[source]

Variant of` kick` that operates with a single job.

Parameters:job_id (str) – the job id to kick
parse_response(connection, command_name, **kwargs)[source]
put(body, priority=2147483648, delay=0, ttr=120)[source]
release(job_id, priority=2147483648, delay=0)[source]
reserve(timeout=None)[source]
stats_tube(tube)[source]
use(tube)[source]
watch(tube)[source]
exception oio.event.beanstalk.BeanstalkError[source]

Bases: exceptions.Exception

class oio.event.beanstalk.Connection(host=None, port=None, use_tubes=None, watch_tubes=None, socket_timeout=None, socket_connect_timeout=None, socket_keepalive=False, socket_keepalive_options=None, encoding='utf-8', socket_read_size=65536)[source]

Bases: object

connect()[source]
disconnect()[source]
classmethod from_url(url, **kwargs)[source]
on_connect()[source]
pack_command(command, body, *args)[source]
read_body(size)[source]
read_response()[source]
send_command(command, *args, **kwargs)[source]
use(tube)[source]
watch(tube)[source]
exception oio.event.beanstalk.ConnectionError[source]

Bases: oio.event.beanstalk.BeanstalkError

exception oio.event.beanstalk.InvalidResponse[source]

Bases: oio.event.beanstalk.BeanstalkError

class oio.event.beanstalk.Reader(socket, socket_read_size)[source]

Bases: object

close()[source]
length
purge()[source]
read(length)[source]
readline()[source]
exception oio.event.beanstalk.ResponseError[source]

Bases: oio.event.beanstalk.BeanstalkError

exception oio.event.beanstalk.TimeoutError[source]

Bases: oio.event.beanstalk.BeanstalkError

oio.event.beanstalk.dict_merge(*dicts)[source]
oio.event.beanstalk.parse_body(connection, response, **kwargs)[source]
oio.event.beanstalk.parse_yaml(connection, response, **kwargs)[source]

oio.event.client module

class oio.event.client.EventClient(conf, **kwargs)[source]

Bases: object

beanstalk
exhume(limit=1000, tube=None)[source]

Move buried or delayed jobs into the ready queue.

stats(tube=None)[source]

oio.event.consumer module

class oio.event.consumer.EventTypes[source]

Bases: object

ACCOUNT_SERVICES = 'account.services'
CHUNK_DELETED = 'storage.chunk.deleted'
CHUNK_NEW = 'storage.chunk.new'
CONTAINER_DELETED = 'storage.container.deleted'
CONTAINER_NEW = 'storage.container.new'
CONTAINER_STATE = 'storage.container.state'
CONTENT_BROKEN = 'storage.content.broken'
CONTENT_DELETED = 'storage.content.deleted'
CONTENT_NEW = 'storage.content.new'
class oio.event.consumer.EventWorker(*args, **kwargs)[source]

Bases: oio.event.consumer.Worker

acct_addr()[source]
acct_refresh()[source]
get_handler(event)[source]
handle(beanstalk)[source]
init()[source]
notify()[source]

TODO

process_event(job_id, event, beanstalk)[source]
run()[source]
safe_decode_job(job_id, data)[source]
exception oio.event.consumer.StopServe[source]

Bases: exceptions.Exception

class oio.event.consumer.Worker(ppid, conf, logger)[source]

Bases: object

SIGNALS = [1, 3, 2, 15, 17]
handle_exit(sig, frame)[source]
handle_quit(sig, frame)[source]
init()[source]
init_signals()[source]
parent_alive()[source]
pid
run()[source]
x = 'CHLD'

oio.event.evob module

class oio.event.evob.Event(env)[source]

Bases: object

data
event_type
job_id
reqid
url
when
exception oio.event.evob.EventException(*args, **kwargs)[source]

Bases: oio.event.evob.Response, exceptions.Exception

class oio.event.evob.Response(body=None, status=200, event=None, **kwargs)[source]

Bases: object

class oio.event.evob.StatusMap[source]

Bases: object

oio.event.evob.is_error(status)[source]
oio.event.evob.is_success(status)[source]

oio.event.loader module

class oio.event.loader.AttrDict[source]

Bases: dict

class oio.event.loader.ConfigLoader(filename)[source]

Bases: object

absolute_name(name)[source]
find_config_section(obj_type, name=None)[source]
get_context(obj_type, name=None, global_conf=None)[source]
get_sections(prefix=None)[source]
class oio.event.loader.CustomConfigParser(filename, *args, **kwargs)[source]

Bases: ConfigParser.ConfigParser

class oio.event.loader.EggLoader(spec)[source]

Bases: oio.event.loader._Loader

find_egg_ep(obj_type, name=None)[source]
get_context(obj_type, name=None, global_conf=None)[source]
class oio.event.loader.LoaderContext(obj, obj_type, protocol, global_conf, local_conf, loader, distribution=None, ep_name=None)[source]

Bases: object

config()[source]
create(**kwargs)[source]
oio.event.loader.loadcontext(obj_type, uri, name=None, global_conf=None)[source]
oio.event.loader.loadhandler(loader, name, global_conf=None, **kwargs)[source]
oio.event.loader.loadhandlers(path, global_conf=None, **kwargs)[source]

Module contents