ComputationalRadiationPhysics / pyDive

Distributed Interactive Visualization and Exploration of large datasets
GNU Lesser General Public License v3.0
15 stars 5 forks source link

pyDive.is_initialized? #14

Open ax3l opened 9 years ago

ax3l commented 9 years ago

pyDive.init() can not be called twice without throwing an error.

Is there a getter method that allows us to check if pyDive is already initialized?

(E.g. MPI offers an MPI_Initialized( flag ) function)

This can be relevant for non-linear (non-script) workflow as they are common in a ipython notebook.

if not pyDive.is_initialized():
    pyDive.init()
heikoburau commented 9 years ago

If we allow pyDive.init() to be called twice, we can save a pyDive.is_initialized() function. Is this right?

ax3l commented 9 years ago

good idea, one could hide that from the user by handling it within init().

Nevertheless, providing an interface to call that internal state is sometimes useful: as an example, imagine an application that uses pyDive together with an other library that depends on pyDive. During init() and shutdown() phases of an application, it is sometimes not 100% obvious in what state pyDive currently is, due to side effects that might be caused by the library that also uses pyDive and does not know the user tries to init()/shutdown it too. (Example taken from an usual issue with libraries that depend on MPI.)