Cryoweb App

cryoweb.helpers

cryoweb.helpers module contents

Created on Mon May 14 10:28:39 2018

@author: Paolo Cozzi <cozzi@ibba.cnr.it>

exception cryoweb.helpers.CryoWebImportError[source]

Bases: Exception

cryoweb.helpers.check_UID(submission)[source]

A function to ensure that UID is valid before data upload. Specific to the module where is called from

cryoweb.helpers.check_countries()[source]

Check that all efabis countries have a dictionary object

cryoweb.helpers.check_species(country)[source]

Check all cryoweb species for a synonym in a supplied language or the default one, ie: check_species(country). country is an uid.models.DictCountry.label

cryoweb.helpers.cryoweb_import(submission)[source]

Import data from cryoweb stage database into UID

Submission

a submission instance

cryoweb.helpers.fill_uid_animals(submission)[source]

Helper function to fill animal data in UID animal table

cryoweb.helpers.fill_uid_breeds(submission)[source]

Fill UID DictBreed model. Require a submission instance

cryoweb.helpers.fill_uid_samples(submission)[source]

Helper function to fill animal data in UID animal table

cryoweb.helpers.get_animal_specie_and_breed(v_animal, language)[source]
cryoweb.helpers.upload_cryoweb(submission_id)[source]

Imports backup into the cryoweb db

This function uses the container’s installation of psql to import a backup file into the “cryoweb” database. The imported backup file is the last inserted into the image’s table uid_submission.

Submission_id

the submission primary key

cryoweb.tasks

cryoweb.tasks module contents

Created on Thu Sep 13 11:33:09 2018

@author: Paolo Cozzi <cozzi@ibba.cnr.it>

Inspired from

http://docs.celeryproject.org/en/latest/tutorials/task-cookbook.html

class cryoweb.tasks.ImportCryowebTask(*args, **kwargs)[source]

Bases: submissions.tasks.ImportGenericTaskMixin, common.tasks.BaseTask

An exclusive task wich upload a data-only cryoweb dump in cryoweb database and then fill up UID tables. After data import (wich could be successful or not) cryoweb helper database is cleanded and restored in the original status:

from cryoweb.tasks import ImportCryowebTask

# call task asynchronously
task = ImportCryowebTask()
res = task.delay(submission_id)
Parameters

submission_id (int) – the submission primary key

Returns

a message string (ex. success)

Return type

str

action = 'cryoweb import'
description = 'Import Cryoweb data from Cryoweb dump'
import_data_from_file(**kwargs)[source]

Call the custom import method

name = 'Import Cryoweb'
run(**kwargs)

a function to upload data into UID

cryoweb.tasks.clean_cryoweb_database(f)[source]