def job_mode(self, single_thread=True):
        """
        This method tells Delphix how to execute jobs, based on the
        single_thread variable

        single_thread: Execute application synchronously (True) or
                       async (False)
                       Default: True
        """

        # Synchronously (one at a time)
        if single_thread is True:
            print_debug("These jobs will be executed synchronously")
            return job_context.sync(self.server_session)

        # Or asynchronously
        elif single_thread is False:
            print_debug("These jobs will be executed asynchronously")
            # 5.3.5 changed the async method to asyncly, so we need to do a version check
            build_version = system.get(self.server_session).build_version
            if LooseVersion(
                "%s.%s.%s"
                % (build_version.major, build_version.minor, build_version.micro)
            ) < LooseVersion("5.3.5"):
                return job_context.asyncly(self.server_session)
            else:
                return job_context.asyncly(self.server_session)
    def refresh_container(self, parent_bookmark_ref, db_type, child_db_ref):
        """
        Refreshes a container

        parent_bookmark_ref: The parent's bookmark reference.
        db_type: The database type
        child_db_ref: The child database reference
        """

        if db_type == "Oracle":
            tf_params = OracleRefreshParameters()
        else:
            tf_params = RefreshParameters()

        tf_params.timeflow_point_parameters = {
            "type": "TimeflowPointBookmark",
            "bookmark": parent_bookmark_ref,
        }

        try:
            with job_context.asyncly(self.engine):
                db_ret_val = database.refresh(self.engine, child_db_ref,
                                              tf_params)
            return db_ret_val

        except RequestError as e:
            dlpx_err = e.message
            raise DlpxException(dlpx_err.action)

        except (JobError, HttpError) as e:
            print_exception("Exception caught during refresh:\n{}".format(
                sys.exc_info()[0]))
Exemplo n.º 3
0
def job_mode(server):
    """
    This function tells Delphix how to execute jobs, based on the
    single_thread variable at the beginning of the file
    """
    # Synchronously (one at a time)
    if single_thread == True:
        job_m = job_context.sync(server)
        print_debug("These jobs will be executed synchronously")
    # Or asynchronously
    else:
        job_m = job_context.asyncly(server)
        print_debug("These jobs will be executed asynchronously")
    return job_m