Class WorkspaceUtils


  • public class WorkspaceUtils
    extends Object
    • Method Detail

      • assertNoWorkspacesOpen

        public static void assertNoWorkspacesOpen​(String msg)
                                           throws ND4JWorkspaceException
        Assert that no workspaces are currently open
        Parameters:
        msg - Message to include in the exception, if required
        Throws:
        ND4JWorkspaceException
      • assertNoWorkspacesOpen

        public static void assertNoWorkspacesOpen​(String msg,
                                                  boolean allowScopedOut)
                                           throws ND4JWorkspaceException
        Assert that no workspaces are currently open
        Parameters:
        msg - Message to include in the exception, if required
        allowScopedOut - If true: don't fail if we have an open workspace but are currently scoped out
        Throws:
        ND4JWorkspaceException
      • assertOpenAndActive

        public static void assertOpenAndActive​(@NonNull
                                               @NonNull String ws,
                                               @NonNull
                                               @NonNull String errorMsg)
                                        throws ND4JWorkspaceException
        Assert that the specified workspace is open and active
        Parameters:
        ws - Name of the workspace to assert open and active
        errorMsg - Message to include in the exception, if required
        Throws:
        ND4JWorkspaceException
      • assertOpenActiveAndCurrent

        public static void assertOpenActiveAndCurrent​(@NonNull
                                                      @NonNull String ws,
                                                      @NonNull
                                                      @NonNull String errorMsg)
                                               throws ND4JWorkspaceException
        Assert that the specified workspace is open, active, and is the current workspace
        Parameters:
        ws - Name of the workspace to assert open/active/current
        errorMsg - Message to include in the exception, if required
        Throws:
        ND4JWorkspaceException
      • assertValidArray

        public static void assertValidArray​(INDArray array,
                                            String msg)
        Assert that the specified array is valid, in terms of workspaces: i.e., if it is attached (and not in a circular workspace), assert that the workspace is open, and that the data is not from an old generation.
        Parameters:
        array - Array to check
        msg - Message (prefix) to include in the exception, if required. May be null