Hi all,
Background
I've been using Datasets and then adding my own attributes directly to the Datasets to store additional info that I need for my app, so like:
dcm = dcmread('/tmp/1.dcm')
dcm.file_name = '/tmp/1.dcm'
However when I did this previously I ran into the 1.3 bug with pickling datasets, as I was passing the Datasets into multiprocessing, which was failing with 1.3 due to the pickling failing.
So I've moved temporarily back to 1.2 until 1.3.1 is out.
In 1.2, multiprocessing (ie pickling) works fine. But, in this case, when i pass the datasets into multiprocessing (ie pickle then depickle in the new processes) _my added attributes are missing._
So my questions are
a) Am I an idiot adding attributes that way, and instead I should be sub-classing Dataset? (I'm fairly new to python, so I just too the quick/dirty approach)
b) Would the above approach (manually adding attributes on the fly) work with pickling in 1.3.x (in which case I'll just pull the latest master instead of using 1.2.2)
There were a couple of issues (#951, #947) with pickling datasets in v1.3. Can you try with the current master?
I think I had a look at this and could reproduce it in master. I may have a closer look tonight.
Ok, I seem to have confused that. The following (added in test_dataset):
def test_pickle_attribute(self):
ds = pydicom.dcmread(self.test_file)
ds.new_attribute = 'test'
import pickle
s = pickle.dumps({'ds': ds})
ds1 = pickle.loads(s)['ds']
assert 'test' == ds1.new_attribute
passes in master, so I guess the answer to b) is yes.
@richard-moss - could you get it to work?
Hey - sorry just seeing this now.
Just checked and it looks like it works!
On Thu, Nov 7, 2019 at 4:48 AM mrbean-bremen notifications@github.com
wrote:
@richard-moss https://github.com/richard-moss - could you get it to
work?—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/pydicom/pydicom/issues/963?email_source=notifications&email_token=AHX43QF2U4HHOETRIRVN6MTQSQFCDA5CNFSM4JGRTCM2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEDMJOBA#issuecomment-551065348,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AHX43QG2HDAD3HUSLF6DD63QSQFCDANCNFSM4JGRTCMQ
.
Ok, closing in this case.
Thanks for fixing this, spent a lot of time figuring out to see why ProcessPoolExecutor not working for my DICOM data pipeline. Besides current dev branch, when might we expect to see this change in a release? Thanks again :)
According to #872, the 1.4 release is planned for December, though there are still quite a few issues open planned to be fixed for that release.