@@ -297,6 +297,8 @@ def screenshot(self):
 | 
			
		||||
 | 
			
		||||
@worker_ready.connect
 | 
			
		||||
def at_start(sender, **k):
 | 
			
		||||
    logger.info("Worker is ready")
 | 
			
		||||
    # create screenshot
 | 
			
		||||
    if not os.path.isfile(SCREENSHOT_FILE):
 | 
			
		||||
        logger.info("Init screenshot file")
 | 
			
		||||
        with sender.app.connection() as conn:
 | 
			
		||||
@@ -304,6 +306,12 @@ def at_start(sender, **k):
 | 
			
		||||
    else:
 | 
			
		||||
        logger.info("Screenshot file already exists")
 | 
			
		||||
 | 
			
		||||
    # cancel running tasks
 | 
			
		||||
    from agenda_culturel.models import BatchImportation
 | 
			
		||||
    logger.info("Cancel running importation tasks")
 | 
			
		||||
    running_tasks = BatchImportation.objects.filter(status=BatchImportation.STATUS.RUNNING).update(status=BatchImportation.STATUS.CANCELED)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@app.task(bind=True)
 | 
			
		||||
def run_all_recurrent_imports(self, only_fb=False):
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user