def follow_targets(self, client, bundle_uuid, subpaths):
        """
        Block on the execution of the given bundle.
        subpaths: list of files to print >>self.stdout, out output as we go along.
        Return READY or FAILED based on whether it was computed successfully.
        """
        subpath_is_file = [None] * len(subpaths)
        subpath_offset = [None] * len(subpaths)

        SLEEP_PERIOD = 1.0

        # Wait for the run to start.
        while True:
            info = client.get_bundle_info(bundle_uuid)
            if info['state'] in (State.RUNNING, State.READY, State.FAILED):
                break
            time.sleep(SLEEP_PERIOD)

        info = None
        run_finished = False
        while True:
            if not run_finished:
                info = client.get_bundle_info(bundle_uuid)
                run_finished = info['state'] in (State.READY, State.FAILED)

            # Read data.
            for i in xrange(0, len(subpaths)):
                # If the subpath we're interested in appears, check if it's a
                # file and if so, initialize the offset.
                if subpath_is_file[i] is None:
                    target_info = client.get_target_info((bundle_uuid, subpaths[i]), 0)
                    if target_info is not None:
                        if target_info['type'] == 'file':
                            subpath_is_file[i] = True
                            # Go to near the end of the file (TODO: make this match up with lines)
                            subpath_offset[i] = max(64 - target_info['size'], 0)
                        else:
                            subpath_is_file[i] = False

                if not subpath_is_file[i]:
                    continue

                # Read from that file.
                while True:
                    READ_LENGTH = 16384
                    result = client.read_file_section((bundle_uuid, subpaths[i]), subpath_offset[i], READ_LENGTH)
                    if not result:
                        break
                    subpath_offset[i] += len(result)
                    self.stdout.write(result)
                    if len(result) < READ_LENGTH:
                        # No more to read.
                        break

            self.stdout.flush()

            # The run finished and we read all the data.
            if run_finished:
                break

            # Sleep, since we've finished reading all the data available.
            time.sleep(SLEEP_PERIOD)

        return info['state']
dataset/ETHPy150Open codalab/codalab-cli/codalab/lib/bundle_cli.py/BundleCLI.follow_targets/swapped operands of `-`