# This is a helper used in the import of ontologies.
# It uses redis to create an atomic global store
# for the currently processing ontologies (by their iris).
# This allows to lock on concurrency problems in the
# way that a job can only parse an ontology (and write content)
# if no other job currently parses this ontology.
REDIS_KEY = "processing_iris"
SEQUENTIAL_LOCK_KEY = 'sequential_parse_locked'
MAX_TRIES = 3
# Marks an ontology (by its iri) as processing.
# As one ontology parsing job can contain multiple
# ontologies this is needed to circumvent
# concurrency problems
end
# This marks an ontology (by its iri) as
# done (in the scope of processing ontology-content
raise UnmarkedProcessingError, "This iri <#{iri}> should've being marked as done, but wasn't marked as processing beforehand" unless successful
end
# This unlocks the iri on an error in order to
# allow processing it again another time.
end
# Basic sequential lock which ensures that only one
# (concurrently executed job) can be really executed
# at the same time (used as part of the sequential queue).
if RedisWrapper.new.sadd(SEQUENTIAL_LOCK_KEY, true)
raise e
end
else
end
end
end