source: mauRepo/MolesManager/trunk/src/libs/migration/client.py @ 8137

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/mauRepo/MolesManager/trunk/src/libs/migration/client.py@8137
Revision 8137, 1.7 KB checked in by mnagni, 8 years ago (diff)

Updated the urls.py in order to allow a static access to css/js/img. Anyway as specified in DJANGO manual

"Django itself doesn’t serve static (media) files, such as images, style sheets, or video. It leaves that job to whichever Web server you choose.
The reasoning here is that standard Web servers, such as Apache, lighttpd and Cherokee, are much more fine-tuned at serving static files than a Web application framework."

Line 
1'''
2Created on 9 Nov 2011
3
4@author: mnagni
5'''
6from libs.migration.processor.loadResources import LoadResources
7from libs.migration.processor.migrationProcess import MigrationProcess
8
9import threading
10import time
11from threading import Timer
12from libs.migration.db.classes import MigrationObject
13from libs.migration.processor.commons import DS_pUBLISHED, DO_BADC
14
15
16
17class MigrationThread(threading.Thread):
18    """
19        Constructs a scheduler for the Moles2 to Moles3 migration.
20        @param interval: define the minimal time, in seconds, between an execution and the successive.
21        If the current migration run takes more than the defined interval the next will starts
22        as soon the previous ends.         
23    """
24    def __init__(self, interval=600):
25        threading.Thread.__init__(self)
26        self._doRun = True   
27        self.interval = interval
28   
29    def stop(self):
30        self._doRun = False
31   
32    def run(self):
33        while self._doRun:
34            startTime = (int)(time.time())
35            timer = Timer(5, self._migrate, ())
36            timer.start()
37            timer.join()
38            diffTime = startTime + self.interval - (int)(time.time()) 
39            if diffTime > 0:
40                time.sleep(diffTime)
41   
42    def _printTime(self):
43        print "From print_time", time.time()   
44
45    def _migrate(self):
46        lr = LoadResources()
47        lr.process()
48
49        mp = MigrationProcess()
50        mp.process()
51
52#record = Moles3EPB.search(CEDA_Observation, 12)
53#print DJEncoder().encode(record)
54
55lr = LoadResources()
56mp = MigrationProcess()
57
58dataEntity = MigrationObject()
59dataEntity.doc_status = DS_pUBLISHED
60dataEntity.doc_owner = DO_BADC
61dataEntity.doc_name = 'dataent_csip.atom'
62
63lr.process()
64mp.process(dataEntity)
65
66
67
68
69
Note: See TracBrowser for help on using the repository browser.