Пример #1
0
def test_Connect_transform_returns_FDWriteStreamConnector_if_output_is_NamedInputPipe(istream):
    nip_mock = mock.MagicMock(spec=NamedInputPipe(
        'test',
        container_path='/bogus/container_path',
        host_path='/bogus/host_path'))
    connection = Connect(istream, nip_mock)
    assert isinstance(connection.transform(), FDWriteStreamConnector)
Пример #2
0
    def test_docker_run_girder_file_to_named_pipe_on_temp_vol(self, params):
        """
        This is a simplified version of test_docker_run_girder_file_to_named_pipe
        it uses the TemporaryVolume, rather than having to setup the volumes
        'manually', this is the approach we should encourage.
        """
        file_id = params.get('fileId')
        pipe_name = 'input_pipe'

        connect = Connect(GirderFileIdToStream(file_id), NamedInputPipe(pipe_name))

        result = docker_run.delay(
            TEST_IMAGE, pull_image=True, container_args=['read', '-p', connect],
            remove_container=True)

        return result.job
Пример #3
0
    def test_docker_run_girder_file_to_named_pipe(self, params):
        tmp_dir = params.get('tmpDir')
        file_id = params.get('fileId')
        mount_dir = '/mnt/girder_worker/data'
        pipe_name = 'input_pipe'

        volumes = {tmp_dir: {'bind': mount_dir, 'mode': 'rw'}}

        connect = Connect(GirderFileIdToStream(file_id),
                          NamedInputPipe(pipe_name, mount_dir, tmp_dir))

        result = docker_run.delay(TEST_IMAGE,
                                  pull_image=True,
                                  container_args=['read', '-p', connect],
                                  remove_container=True,
                                  volumes=volumes)

        return result.job
def test_NamedInputPipe_transform_returns_NamedPipeWriterr():
    nip = NamedInputPipe('test',
                         container_path='/bogus/container_path',
                         host_path='/bogus/host_path')
    with mock.patch('girder_worker.docker.io.os.mkfifo'):
        assert isinstance(nip.transform(), NamedPipeWriter)