0

I am trying to execute influxdb multiprocessing example: https://github.com/influxdata/influxdb-client-python/blob/master/examples/import_data_set_multiprocessing.py

 with concurrent.futures.ProcessPoolExecutor(cpu_count, initializer=init_counter,
                                                initargs=(counter_, progress_, queue_)) as executor:
        """
        Converts incoming HTTP stream into sequence of LineProtocol
        """
        data = rx \
            .from_iterable(DictReader(io_wrapper)) \
            .pipe(ops.buffer_with_count(10_000),
                  # Parse 10_000 rows into LineProtocol on subprocess
                  ops.flat_map(lambda rows: executor.submit(parse_rows, rows, content_length)))

        """
        Write data into InfluxDB
        """
        data.subscribe(on_next=lambda x: None, on_error=lambda ex: print(f'Unexpected error: {ex}'))

Getting following error on execution.

 Unexpected error: 'Future' object is not iterable
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/reactivex/observable/observable.py", line 125, in set_disposable
    subscriber = self._subscribe_core(auto_detach_observer, scheduler)
  File "/usr/local/lib/python3.9/site-packages/reactivex/observable/observable.py", line 49, in _subscribe_core
    return self._subscribe(observer, scheduler) if self._subscribe else Disposable()
  File "/usr/local/lib/python3.9/site-packages/reactivex/observable/fromiterable.py", line 31, in subscribe
    iterator = iter(iterable)
TypeError: 'Future' object is not iterable
Anish
  • 1,920
  • 11
  • 28
  • 48

0 Answers0