res=run_sql('''SELECT id FROM schTASK WHERE proc LIKE "bibupload%" AND user <> "bibreformat" AND status IN ("WAITING", "SCHEDULED", "RUNNING", "CONTINUING", "ABOUT TO STOP", "ABOUT TO SLEEP", "SLEEPING")''')
return[row[0]forrowinres]
def_get_bibupload_filenames():
"""Return paths to all files scheduled for upload."""
task_ids=_get_bibupload_task_ids()
filenames=[]
tasks_opts=get_bibupload_task_opts(task_ids)
fortask_optsintasks_opts:
iftask_opts:
record_options=marshal.loads(task_opts[0][0])
foroptioninrecord_options[1:]:
ifre_file_option.search(option):
filenames.append(option)
returnfilenames
def_record_in_files_p(recid,filenames):
"""Search XML files for given record."""
# Get id tags of record in question
rec_oaiid=rec_sysno=-1
rec_oaiid_tag=get_fieldvalues(recid,OAIID_TAG)
rec_sysno_tag=get_fieldvalues(recid,SYSNO_TAG)
ifrec_sysno_tag:
rec_sysno=rec_sysno_tag[0]
# For each record in each file, compare ids and abort if match is found
forfilenameinfilenames:
try:
ifCFG_BIBEDIT_QUEUE_CHECK_METHOD=='regexp':
# check via regexp: this is fast, but may not be precise