def operation_start(cls, crawler, stage, run_id): if not conn.sismember(make_key(crawler, "runs"), run_id): conn.sadd(make_key(crawler, "runs"), run_id) conn.set(make_key("run", run_id, "start"), pack_now()) conn.incr(make_key("run", run_id)) conn.incr(make_key("run", run_id, "total_ops")) conn.incr(make_key(crawler, stage)) conn.incr(make_key(crawler, "total_ops")) conn.set(make_key(crawler, "last_run"), pack_now()) conn.set(make_key(crawler, "current_run"), run_id)
def is_aborted(cls, crawler, run_id): key = make_key(crawler, "runs_abort") return conn.sismember(key, run_id)