Skip to content
Snippets Groups Projects
Commit 0c4adfb0 authored by Mikhail Karnevskiy's avatar Mikhail Karnevskiy
Browse files

Remove static function to fix producer.

parent 02cd1e93
No related branches found
No related tags found
No related merge requests found
......@@ -463,26 +463,6 @@ cdef class PyProducer:
with nogil:
if self.c_producer.get() is not NULL:
self.c_producer.get().StopThreads__()
@staticmethod
def __create_producer(endpoint,type,instance_id,pipeline_step,beamtime_id,beamline,data_source,token,nthreads,timeout_ms):
pyProd = PyProducer()
cdef Error err
cdef SourceType source_type
err = GetSourceTypeFromString(type,&source_type)
if err:
throw_exception(err)
cdef SourceCredentials source
source.instance_id = instance_id
source.pipeline_step = pipeline_step
source.beamtime_id = beamtime_id
source.beamline = beamline
source.user_token = token
source.data_source = data_source
source.type = source_type
pyProd.c_producer = Producer.Create(endpoint,nthreads,RequestHandlerType_Tcp,source,timeout_ms,&err)
if err:
throw_exception(err)
return pyProd
def create_producer(endpoint,type,beamtime_id,beamline,data_source,token,nthreads,timeout_ms,instance_id='auto',pipeline_step='auto'):
"""
......@@ -508,7 +488,24 @@ def create_producer(endpoint,type,beamtime_id,beamline,data_source,token,nthread
AsapoWrongInputError: wrong input (number of threads, ,,,)
AsapoProducerError: actually should not happen
"""
return PyProducer.__create_producer(_bytes(endpoint),_bytes(type),_bytes(instance_id),_bytes(pipeline_step),_bytes(beamtime_id),_bytes(beamline),_bytes(data_source),_bytes(token),nthreads,timeout_ms)
pyProd = PyProducer()
cdef Error err
cdef SourceType source_type
err = GetSourceTypeFromString(_bytes(type),&source_type)
if err:
throw_exception(err)
cdef SourceCredentials source
source.instance_id = _bytes(instance_id)
source.pipeline_step = _bytes(pipeline_step)
source.beamtime_id = _bytes(beamtime_id)
source.beamline = _bytes(beamline)
source.user_token = _bytes(token)
source.data_source = _bytes(data_source)
source.type = source_type
pyProd.c_producer = Producer.Create(_bytes(endpoint),nthreads,RequestHandlerType_Tcp,source,timeout_ms,&err)
if err:
throw_exception(err)
return pyProd
__version__ = "@PYTHON_ASAPO_VERSION@@ASAPO_VERSION_COMMIT@"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment