Baunsgaard commented on a change in pull request #874: Add SystemDSContext for systemds operations URL: https://github.com/apache/systemml/pull/874#discussion_r403496467
########## File path: src/main/python/docs/source/matrix.rst ########## @@ -23,6 +23,23 @@ Matrix API ========== +SystemDSContext +--------------- + +Since we always need a java instance running which will can execute operations in SystemDS, we +need to start this connection at some point. We do this with ``SystemDSContext``. A ``SystemDSContext`` +object has to be created and once we are finished ``.close()`` has to be called on it, or +we can use it by doing ``with SystemDSContext() as context:``, which will automatically close +the context if an error occurs or we are finished with our operations. Creating an context is +an expensive procedure, because we might have to start a subprocess running java, therefore +try to do this only once for your program, or always leave at least one context open. Review comment: I would rewrite this, to target the reader not "us". ``` All operations using SystemDS need a running Java instance. To enable this a ``SystemDSContext`` is used for the Python API. A ``SystemDSContext`` can be created using:: [Insert example] Note that once the computation is finished the ``.close()`` has to be called on the ``SystemDSContext`` object. This can also be done using:: [Insert example2] This syntax has the extra benefit which will automatically close the context if an error occurs or we are finished with our operations. .. note:: Creating an context is an expensive procedure, because a sub-process starting a JVM might have to start, therefore try to do this only once for your program, or always leave at least one context open. ``` ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services