Small fixes

This commit is contained in:
Inga Kirschnick 2022-11-11 13:38:41 +01:00
parent a8af1f3d23
commit ca4abc3269
3 changed files with 10 additions and 3 deletions

View File

@ -53,7 +53,12 @@ def _create_job_service(job):
command += f' --mem-mb {mem_mb}' command += f' --mem-mb {mem_mb}'
command += f' --n-cores {n_cores}' command += f' --n-cores {n_cores}'
if job.service == 'spacy-nlp-pipeline': if job.service == 'spacy-nlp-pipeline':
command += f' -m {job.service_args["model"]}' model_id = hashids.decode(job.service_args['model'])
model = SpaCyNLPPipelineModel.query.get(model_id)
if model is None:
job.status = JobStatus.FAILED
return
command += f' -m {model.pipeline_name}'
if 'encoding_detection' in job.service_args and job.service_args['encoding_detection']: if 'encoding_detection' in job.service_args and job.service_args['encoding_detection']:
command += ' --check-encoding' command += ' --check-encoding'
elif job.service == 'tesseract-ocr-pipeline': elif job.service == 'tesseract-ocr-pipeline':
@ -139,6 +144,8 @@ def _create_job_service(job):
) )
''' ## Restart policy ## ''' ''' ## Restart policy ## '''
restart_policy = docker.types.RestartPolicy() restart_policy = docker.types.RestartPolicy()
print(command)
print(mounts)
try: try:
docker_client.services.create( docker_client.services.create(
image, image,

View File

@ -698,7 +698,7 @@ class SpaCyNLPPipelineModel(FileMixin, HashidMixin, db.Model):
db.session.add(model) db.session.add(model)
db.session.flush(objects=[model]) db.session.flush(objects=[model])
db.session.refresh(model) db.session.refresh(model)
model.filename = f'{model.id}.traineddata' model.filename = m['url'].split('/')[-1]
r = requests.get(m['url'], stream=True) r = requests.get(m['url'], stream=True)
pbar = tqdm( pbar = tqdm(
desc=f'{model.title} ({model.filename})', desc=f'{model.title} ({model.filename})',

View File

@ -62,4 +62,4 @@ spacy-nlp-pipeline:
methods: methods:
- 'encoding_detection' - 'encoding_detection'
publishing_year: 2022 publishing_year: 2022
url: 'https://gitlab.ub.uni-bielefeld.de/sfb1288inf/spacy-nlp-pipeline/ url: 'https://gitlab.ub.uni-bielefeld.de/sfb1288inf/spacy-nlp-pipeline/'