CDS Invenio: unblock records that are “currently being edited by another user” [SOLVED]

When someone is editing a record via bibedit web interface, the record is temporary blocked by Invenio. If anyone tries to edit the record via bibedit at the same time, the message “This record is currently being edited by another user” is shown. If you want to unblock that record (without waiting CFG_BIBEDIT_TIMEOUT seconds), you can run:

sudo -u apache inveniogc -a

And run bibsched tasks.

If still blocked, then delete $PATHTOINVENIO/var/tmp/bibedit_record_$RECID*

All the interesting stuff is in bibedit_engine.py. More precisely, in get_record function:

def get_record(ln, recid, uid, temp):
    """Returns a record dict, and warning message in case of error. """
    #FIXME: User doesn't get submit button if reloading BibEdit-page
    #FIXME: User will get warning of changes being temporary when reloading
    #   BibEdit-page, even though no changes have been made.
 
    warning_temp_file = ''
    file_path = get_file_path(recid)
 
    if temp != "false":
        warning_temp_file = bibedit_templates.tmpl_warning_temp_file(ln)
 
    if os.path.isfile("%s.tmp" % file_path):
 
        (uid_record_temp, record) = get_temp_record("%s.tmp" % file_path)
        if uid_record_temp != uid:
 
            time_tmp_file = os.path.getmtime("%s.tmp" % file_path)
            time_out_file = int(time.time()) - CFG_BIBEDIT_TIMEOUT
 
            if time_tmp_file < time_out_file :
                os.system("rm %s.tmp" % file_path)
                record = create_record(print_record(recid, 'xm'))[0]
                save_temp_record(record, uid, "%s.tmp" % file_path)
 
            else:
                record = ''
 
        else:
            warning_temp_file = bibedit_templates.tmpl_warning_temp_file(ln)
 
    else:
        record = create_record(print_record(recid, 'xm'))[0]
        save_temp_record(record, uid, "%s.tmp" % file_path)
 
    return (record, warning_temp_file)

If a message like “There is a new revision of …” shows up, then a user is MBI/SRV the record. Until this user finishes the MBI/SRV process and the bibsched associated task is run, the record is blocked.

More options regarding the lock level are shown in invenio.conf:

## CFG_BIBEDIT_LOCKLEVEL -- when a user tries to edit a record being edited by
## another user, the lock level determines when it is permitted to do so.
## Level 0 - permits editing if there are no recent edit sessions in tmp directory
##           (unsafe, use only if you know what you are doing)
## Level 1 - permits editing if there are no queued bibedit tasks for this record
##           (safe with respect to bibedit, but not for other bibupload maintenance jobs)
## Level 2 - permits editing if there are no queued bibupload tasks of any sort
##           (safe, but may lock more than necessary if many cataloguers around)
## Level 3 - permits editing if no queued bibupload task concerns given record
##           (safe, most precise locking, but slow,
##            checks for 001/EXTERNAL_SYSNO_TAG/EXTERNAL_OAIID_TAG)
## The recommended level is 3 (default) or 2 (if you use maintenance jobs often).
CFG_BIBEDIT_LOCKLEVEL = 3

The inveniogc -a command is supposed to delete the temporary logs, guest user related information, caches, deleted documents and done tasks. But surprisingly, the inveniogc -a command does not delete every file in $PATH_TO_INVENIO/var/tmp/* (called CFG_TMPDIR in config.py), it only deletes those called rec_fmt_*, bibharvestadmin*, bibconvertrun.*, oaiharvest*, oai_archive*. There are a lot of other files that are not deleted (for instance, some called DOCID-RN-date_time). Still wondering whether these files can be safely deleted manually.

I have been looking at the websubmit_functions. Both Insert_Record and Insert_Modify_Record write in CFG_TMPDIR.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Post Navigation