populse / populse_mia

Multiparametric Image Analysis
Other
10 stars 9 forks source link

error while importing outputs in "process_name", from capsul. #215

Closed servoz closed 3 years ago

servoz commented 3 years ago

I see this message at the end of the calculation of a process (say for the process/brick spm Smooth of mia_processes):

error while importing outputs in Smooth
outputs: {'smoothed_files': '/data_2/populse_mia_project/test/data/derived_data/salej170316_test24042018-IRMFonct.+perfusion-2016-03-17083444-1-T13DSENSE-T1TFE-000425.000.nii', 'spm_script_file': '/data_2/populse_mia_project/test/scripts/pyscript_smooth_b14e9ac6-0a28-46f0-a9cf-40b6c173fa3d.m'}

I confess that I do not understand this message that comes from capsul.engine.run.wait()

Since we see the previous message in the standard output, this means that the try statement has worked without raising an exception. So why write in this case, in the standard output, that there is an error? Wouldn't it rather be?:

try:
                        process.import_from_dict(out_params)
except Exception as e:
                        print('error while importing outputs in', process.name)
                        print('outputs:', out_params)
                        print(e)

This is not very serious because it does not prevent the proper working of mia, but it pollutes the stdout unnecessarily... Please @denisri , can you give us your opinion on the subject?

denisri commented 3 years ago

This is mainly a debug message, but the real question is: what is the error and why (the print(e) but it doesn't seem to be in the output you have exhibited here). The try.. except allows not to stop execution and still process the rest of the jobs, but if it happens, then the output values are actually not set on the process output parameters traits, which in fact can be a real problem if outputs are used by a later job. Thus just dropping the outputs is not a really acceptable solution. So I have set this prints to debug why parameters are not set in some situations, but did not solve it yet. For instance in your example, why are the values not acceptable by the traits of the process, do they have a wrong type or anything else ?

servoz commented 3 years ago

I think I didn't make myself clear ... We can't see the output of print(e) since in the current code (comes from capsul.engine.run.wait()) print(e) is executed only when the exception is raised... Here it is not the case ... And this is the real question of this ticket I think ... Thanks for the explanation of the try ..except.

denisri commented 3 years ago

Oh OK I didn't understand... It's a mistake, yes of course... I'm fixing that right now.