How to map multiprocessing pool per columns

Hi, I am trying to use multiprocessing for every columns.

So for example, if there are 3columns, then I would like to create pool of three cpu’s and arrange each to every columns.

Below is what I have tried but it is not working… Can anybody help?

import streamlit as st
import os

from multiprocessing import Pool

def write(param):
  global cols
  print(f'{param} {os.getpid()} {cols}')
  with cols[param[0]]:
    st.subheader(f'{param[1]}')

st.title('Multiprocessing Test')
cols = st.columns(3)
params = [[i, i+10] for i in range(3)]
pool = Pool(3)
pool.map(write, params)
pool.close()
pool.join()

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.