Closed r78v10a07 closed 5 years ago
Hello @r78v10a07, thank you for your issue.
LoggingProxy
isn't part of the cwltool
codebase. Maybe celery or you need to configure the logging differently? Take a look at cwltool/loghandler.py
Hi,I managed to get the cwltool running from Celery using this method in my tasks
@signals.setup_logging.connect
def setup_celery_logging(**kwargs):
pass
Although, I don't see any error and the cwltool output dict is printed out in the stdout the files are not in the folder they should be.
Any idea?
@r78v10a07 Glad to hear about the progress!
the files are not in the folder they should be.
Which folder do you want them in? Did you set runtimeContext.outdir
to match?
Hi,
runtimeContext.outdir
fixed my problem. Everything is working fine now.
Thanks a lot.
Best,
Roberto
Hi @r78v10a07.
Can you explain how did you setup up runtimeContext.outdir
variable?
Because I tried to change it, but it does not work
Error - AttributeError: 'LoggingProxy' object has no attribute 'fileno'
Hi,
This is my config:
import os
from cwltool.context import RuntimeContext
def ngsworkflow_runtimeContext():
runtimeContext = RuntimeContext()
cwltool_base_dir = os.getenv('CWLTOOL_BASE_DIR', '/Users/veraalva/Work/Developer/Python/cwl-workflow/')
runtimeContext.use_container = os.getenv('CWLTOOL_USE_DOCKER', False)
runtimeContext.tmp_outdir_prefix = os.getenv('TMP_OUTDIR_PREFIX', '/tmp/')
runtimeContext.tmpdir_prefix = os.getenv('TMPDIR_PREFIX', '/tmp/')
runtimeContext.outdir = os.getenv('OUTDIR', '/Users/veraalva/')
return runtimeContext
This is the workflow function:
import os
import json
import pandas
import cwltool
import cwltool.factory
from ngsworkflow.ngsworkflow_runtimeContext import ngsworkflow_runtimeContext
def r_pca_corr(data, cwltool_base_dir):
runtimeContext = ngsworkflow_runtimeContext()
fac = cwltool.factory.Factory(runtime_context=runtimeContext)
workflow = fac.make(cwltool_base_dir + '/tools/R/r_pca_corr.cwl')
results = workflow(
matrix={
"class": "File",
"location": data['matrix']
},
factor={
"class": "File",
"location": data['sample']
},
gene_column=data['colgene'],
sample_column=data['colsample'],
min_reads=data['min'],
condition1=data['cond1'],
condition2=data['cond2'],
out=data['out'])
return result
Finally the Celery task:
from __future__ import absolute_import, unicode_literals
from celery import shared_task
from celery import signals
from ngsworkflow.r_pca_corr import r_pca_corr
@signals.setup_logging.connect
def setup_celery_logging(**kwargs):
pass
@shared_task
def dngsstats_analysis_cwl(data, cwltool_base_dir):
result = r_pca_corr(data, cwltool_base_dir)
return result
The method you're missing is, see the previous code snippet:
@signals.setup_logging.connect
def setup_celery_logging(**kwargs):
pass
Hi,
Expected Behavior
Use cwltool in a Celery task
Actual Behavior
Exception while running job:
AttributeError: 'LoggingProxy' object has no attribute 'fileno'
Workflow Code
Full Traceback
Your Environment
cwltool 1.0.20181217162649 celery 4.2.1 (windowlicker)