job queue: fix loss of finalized opcode result
authorIustin Pop <iustin@google.com>
Sun, 19 Jul 2009 01:45:45 +0000 (03:45 +0200)
committerIustin Pop <iustin@google.com>
Sun, 19 Jul 2009 16:36:26 +0000 (18:36 +0200)
commit34327f511aac3bbf4a0f8afc4e002a15a03596d5
tree539a5758e6b89111923e84e9f140d969753fdb1d
parentb59252feb90e3f6c3754c5e464dc28c895ac0c2b
job queue: fix loss of finalized opcode result

Currently, unclean master daemon shutdown overwrites all of a job's
opcode status and result with error/None. This is incorrect, since the
any already finished opcode(s) should have their status and result
preserved, and only not-yet-processed opcodes should be marked as
‘error’. Cancelling jobs between opcodes does the same (but this is not
allowed currently by the code, so it's not as important as unclean
shutdown).

This patch adds a new _QueuedJob function that only overwrites the
status and result of finalized opcodes, which is then used in job queue
init and in the cancel job functions. The patch also adds some comments
and a new set constants in constants.py highlighting the finalized vs.
non-finalized opcode statuses.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>
lib/constants.py
lib/jqueue.py