Yedidyah Bar David has posted comments on this change.

Change subject: core: Add executePipe
......................................................................


Patch Set 21: Verified+1 Code-Review+1

Did quite many tests and it seems to be ok.

To test the latest changeset I used:

        stdin=u'test1234\n' * 10
        self.logger.debug('after setting stdin')
        fd, name = tempfile.mkstemp()
        os.close(fd)
        f = open(name, 'w')
        d = self.executePipe(
            [
                #{
                #    'args': (
                #        'ls',
                #        '-l',
                #        '/',
                #        '/non-existtent',
                #    ),
                #    'stderr': f,
                #},
                {
                    'args': (
                        'yes',
                        'test1234',
                    ),
                },
                {
                    'args': (
                        'head',
                        '-100000',
                    ),
                },
                {
                    'args': (
                        'gawk',
                        '{print; for (i=0; i<=1000; i++);}',
                    ),
                },
                {
                    'args': (
                        'wc',
                        '-l',
                    ),
                },
                #{
                #    'args': (
                #        'sleep',
                #        '6'
                #    ),
                #},
            ],
            #stdin=['abcd', 'efgh', 'xyzx'],
            stdin=stdin,
            raiseOnError=False,
            callback_interval=1,
            callback=lambda (state): self.logger.info(
                #'waiting for command to finish - state: %s' % [
                #    '[%s]: args: %s popen: %s streams: %s' % (
                #        n,
                #        s['args'],
                #        s['popen'],
                #        [
                #            '%s: events %s fd %s buffer_index %s' % (
                #                k,
                #                v['events'],
                #                v.get('fd', 'NoFD'),
                #                v.get('buffer_index', 'NoBufInd'),
                #            )
                #            for k, v in s['streams'].items()
                #        ],
                #    )
                #    for n, s in enumerate(state)
                #],
                'waiting for command to finish - state: %s' % [
                    '[%s]: args: %s streams: %s' % (
                        n,
                        s['args']['args'],
                        [
                            '%s: fd %s buffer_index %s' % (
                                kk,
                                v.get('fd', 'NoFD'),
                                v.get('buffer_index', 'NoBufInd'),
                            )
                            for k, v in s['streams'].items()
                        ],
                    )
                    for n, s in enumerate(state)
                ],
            ),
            logStreams=False,
        )
        f.close()

This fails because 'kk' is undefined, so we get an exception and can see how 
it's logged. Replace with 'k' and comment/uncomment parts to test the positive 
flows.

-- 
To view, visit http://gerrit.ovirt.org/26213
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I4a434fbe1308ac2f603b8ae09756354c11138912
Gerrit-PatchSet: 21
Gerrit-Project: otopi
Gerrit-Branch: master
Gerrit-Owner: Yedidyah Bar David <d...@redhat.com>
Gerrit-Reviewer: Alon Bar-Lev <alo...@redhat.com>
Gerrit-Reviewer: Sandro Bonazzola <sbona...@redhat.com>
Gerrit-Reviewer: Simone Tiraboschi <stira...@redhat.com>
Gerrit-Reviewer: Yedidyah Bar David <d...@redhat.com>
Gerrit-Reviewer: automat...@ovirt.org
Gerrit-HasComments: No
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to