mirror of
				https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
				synced 2025-10-31 02:32:45 +00:00 
			
		
		
		
	Use APScheduler to handle job execution.
This commit is contained in:
		| @@ -22,7 +22,7 @@ def nlp(): | ||||
|                       service='nlp', | ||||
|                       service_args=json.dumps(['-l {}'.format(new_nlp_job_form.language.data)]), | ||||
|                       service_version=new_nlp_job_form.version.data, | ||||
|                       status='submitted', | ||||
|                       status='preparing', | ||||
|                       title=new_nlp_job_form.title.data) | ||||
|  | ||||
|         db.session.add(nlp_job) | ||||
| @@ -48,8 +48,8 @@ def nlp(): | ||||
|             ' NOTE: Using self created threads is just for testing purpose as | ||||
|             '       there is no scheduler available. | ||||
|             ''' | ||||
|             thread = Thread(target=swarm.run, args=(nlp_job.id,)) | ||||
|             thread.start() | ||||
|             nlp_job.status = 'submitted' | ||||
|             db.session.commit() | ||||
|             flash('Job created!') | ||||
|         return redirect(url_for('services.nlp')) | ||||
|  | ||||
| @@ -74,7 +74,7 @@ def ocr(): | ||||
|                         '-l {}'.format(new_ocr_job_form.language.data), | ||||
|                         '--skip-binarisation']), | ||||
|                       service_version=new_ocr_job_form.version.data, | ||||
|                       status='submitted', | ||||
|                       status='preparing', | ||||
|                       title=new_ocr_job_form.title.data) | ||||
|  | ||||
|         db.session.add(ocr_job) | ||||
| @@ -94,14 +94,8 @@ def ocr(): | ||||
|         else: | ||||
|             for file in new_ocr_job_form.files.data: | ||||
|                 file.save(os.path.join(dir, file.filename)) | ||||
|             ''' | ||||
|             ' TODO: Let the scheduler run this job in the background. | ||||
|             ' | ||||
|             ' NOTE: Using self created threads is just for testing purpose as | ||||
|             '       there is no scheduler available. | ||||
|             ''' | ||||
|             thread = Thread(target=swarm.run, args=(ocr_job.id,)) | ||||
|             thread.start() | ||||
|             ocr_job.status = 'submitted' | ||||
|             db.session.commit() | ||||
|             flash('Job created!') | ||||
|         return redirect(url_for('services.ocr')) | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user