How to use the nipyapi.utils.wait_to_complete function in nipyapi

To help you get started, we’ve selected a few nipyapi examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Chaffelson / nipyapi / nipyapi / canvas.py View on Github external
con_id_,
            drop_request_.drop_request.id
        ).drop_request
        if not test_obj.finished:
            return False
        if test_obj.failure_reason:
            raise ValueError(
                "Unable to complete drop request{0}, error was {1}"
                .format(test_obj, test_obj.drop_request.failure_reason)
            )
        return True

    with nipyapi.utils.rest_exceptions():
        drop_req = nipyapi.nifi.FlowfileQueuesApi().create_drop_request(con_id)
    assert isinstance(drop_req, nipyapi.nifi.DropRequestEntity)
    return nipyapi.utils.wait_to_complete(_autumn_leaves, con_id, drop_req)
github Chaffelson / nipyapi / nipyapi / canvas.py View on Github external
return False

    assert isinstance(
        get_process_group(process_group_id, 'id'),
        nipyapi.nifi.ProcessGroupEntity
    )
    result = schedule_components(
        pg_id=process_group_id,
        scheduled=scheduled
    )
    # If target scheduled state was successfully updated
    if result:
        # If we want to stop the processor
        if not scheduled:
            # Test that the processor threads have halted
            stop_test = nipyapi.utils.wait_to_complete(
                _running_schedule_process_group,
                process_group_id
            )
            if stop_test:
                # Return True if we stopped the Process Group
                return result
            # Return False if we scheduled a stop, but it didn't stop
            return False
    # Return the True or False result if we were trying to start it
    return result
github Chaffelson / nipyapi / nipyapi / canvas.py View on Github external
controller=controller,
            update=nipyapi.nifi.ControllerServiceDTO(
                state=target_state
            )
        )
    else:
        result = handle.update_run_status(
            id=controller.id,
            body=nipyapi.nifi.ControllerServiceRunStatusEntity(
                revision=controller.revision,
                state=target_state
            )
        )
    if not result:
        raise ValueError("Scheduling request failed")
    state_test = nipyapi.utils.wait_to_complete(
        _schedule_controller_state,
        controller.id,
        target_state,
        nipyapi_delay=nipyapi.config.long_retry_delay,
        nipyapi_max_wait=nipyapi.config.long_max_wait
    )
    if state_test:
        return get_controller(controller.id, 'id')
    raise ValueError("Scheduling request timed out")
github Chaffelson / nipyapi / nipyapi / versioning.py View on Github external
" for the latest version to be fetched")
            ver = target_version
        u_init = nipyapi.nifi.VersionsApi().initiate_version_control_update(
            id=process_group.id,
            body=nipyapi.nifi.VersionControlInformationEntity(
                process_group_revision=vci.process_group_revision,
                version_control_information=VciDTO(
                    bucket_id=vci.version_control_information.bucket_id,
                    flow_id=vci.version_control_information.flow_id,
                    group_id=vci.version_control_information.group_id,
                    registry_id=vci.version_control_information.registry_id,
                    version=ver
                )
            )
        )
        nipyapi.utils.wait_to_complete(_running_update_flow_version)
        return nipyapi.nifi.VersionsApi().get_update_request(
            u_init.request.request_id
        )
github Chaffelson / nipyapi / nipyapi / demo / secure_connection.py View on Github external
test_function=nipyapi.security.get_service_access_status,
    service='registry',
    bool_response=True,
    nipyapi_delay=nipyapi.config.long_retry_delay,
    nipyapi_max_wait=nipyapi.config.long_max_wait
)
pprint('nipyapi_secured_registry CurrentUser: ' + registry_user.identity)

log.info("Creating NiFi security context")
nipyapi.utils.set_endpoint(secured_nifi_url)
nipyapi.security.set_service_ssl_context(
    service='nifi',
    ca_file=host_certs_path + '/localhost-ts.pem'
)
log.info("Waiting for NiFi to be ready for login")
nipyapi.utils.wait_to_complete(
    test_function=nipyapi.security.service_login,
    service='nifi',
    username='nobel',
    password='password',
    bool_response=True,
    nipyapi_delay=nipyapi.config.long_retry_delay,
    nipyapi_max_wait=nipyapi.config.long_max_wait
)
nifi_user = nipyapi.security.get_service_access_status(service='nifi')
pprint(
    'nipyapi_secured_nifi CurrentUser: ' + nifi_user.access_status.identity
)

log.info("Granting NiFi user access to root process group")
bootstrap_nifi_access_policies()
github Chaffelson / nipyapi / nipyapi / demo / secure_connection.py View on Github external
docker_containers=d_containers,
    network_name=d_network_name
)

log.info("Creating Registry security context")
nipyapi.utils.set_endpoint(secured_registry_url)
log.info("Using demo certs from %s", host_certs_path)
nipyapi.security.set_service_ssl_context(
    service='registry',
    ca_file=path.join(host_certs_path, 'localhost-ts.pem'),
    client_cert_file=path.join(host_certs_path, 'client-cert.pem'),
    client_key_file=path.join(host_certs_path, 'client-key.pem'),
    client_key_password='clientPassword'
)
log.info("Waiting for Registry to be ready for login")
registry_user = nipyapi.utils.wait_to_complete(
    test_function=nipyapi.security.get_service_access_status,
    service='registry',
    bool_response=True,
    nipyapi_delay=nipyapi.config.long_retry_delay,
    nipyapi_max_wait=nipyapi.config.long_max_wait
)
pprint('nipyapi_secured_registry CurrentUser: ' + registry_user.identity)

log.info("Creating NiFi security context")
nipyapi.utils.set_endpoint(secured_nifi_url)
nipyapi.security.set_service_ssl_context(
    service='nifi',
    ca_file=host_certs_path + '/localhost-ts.pem'
)
log.info("Waiting for NiFi to be ready for login")
nipyapi.utils.wait_to_complete(