Write to output that a process has started.
180102
public function onTranscodeStart(TranscodeEvent $e)
    {
        $inpath = $e->getInputPath();
        $presetKey = $e->getPreset();

        $formatter = $this->getFormatter();
        $msg = sprintf(
            "Starting transcode of file %s with preset %s ...",
            $formatter->formatBlock($inpath, 'info'),
            $formatter->formatBlock($presetKey, 'info')
        );

        $this->getOutput()->writeln($msg);
        $this->startTime = microtime(true);
    }
715741
def write(self):
        ''''''
        f = open('status.txt', mode='w')
        self.show(f)
        f.close()
137240
def write(self, out):
        """"""
        out.write_short(self.priority)
        out.write_short(self.weight)
        out.write_short(self.port)
        out.write_name(self.server)
118775
def start_process(self, key):
        """"""
        if key in self.processes and key in self.paused:
            os.killpg(os.getpgid(self.processes[key].pid), signal.SIGCONT)
            self.queue[key]['status'] = 'running'
            self.paused.remove(key)
            return True
        elif key not in self.processes:
            if self.queue[key]['status'] in ['queued', 'stashed']:
                self.spawn_new(key)
                return True

        return False
899558
def check_finished(self):
        """"""
        changed = False
        for key in list(self.processes.keys()):
            # Poll process and check if it finshed
            process = self.processes[key]
            process.poll()
            if process.returncode is not None:
                # If a process is terminated by `stop` or `kill`
                # we want to queue it again instead closing it as failed.
                if key not in self.stopping:
                    # Get std_out and err_out
                    output, error_output = process.communicate()

                    descriptor = self.descriptors[key]
                    descriptor['stdout'].seek(0)
                    descriptor['stderr'].seek(0)
                    output = get_descriptor_output(descriptor['stdout'], key, handler=self)
                    error_output = get_descriptor_output(descriptor['stderr'], key, handler=self)

                    # Mark queue entry as finished and save returncode
                    self.queue[key]['returncode'] = process.returncode
                    if process.returncode != 0:
                        self.queue[key]['status'] = 'failed'
                    else:
                        self.queue[key]['status'] = 'done'

                    # Add outputs to queue
                    self.queue[key]['stdout'] = output
                    self.queue[key]['stderr'] = error_output
                    self.queue[key]['end'] = str(datetime.now().strftime("%H:%M"))

                    self.queue.write()
                    changed = True
                else:
                    self.stopping.remove(key)
                    if key in self.to_remove:
                        self.to_remove.remove(key)
                        del self.queue[key]
                    else:
                        if key in self.to_stash:
                            self.to_stash.remove(key)
                            self.queue[key]['status'] = 'stashed'
                        else:
                            self.queue[key]['status'] = 'queued'
                        self.queue[key]['start'] = ''
                        self.queue[key]['end'] = ''

                    self.queue.write()

                self.clean_descriptor(key)
                del self.processes[key]

        # If anything should be logged we return True
        return changed
755000
def handle_write(self):
        """"""
        num_sent = self.send(self.write_buffer)
        if self.debug:
            if self.state is not STATE_NOT_STARTED or options.password is None:
                self.print_debug(b'<== ' + self.write_buffer[:num_sent])
        self.write_buffer = self.write_buffer[num_sent:]
7533
def start_output (self):
        """"""
        super(DOTLogger, self).start_output()
        if self.has_part("intro"):
            self.write_intro()
            self.writeln()
        self.writeln(u"digraph G {")
        self.writeln(u"  graph [")
        self.writeln(u"    charset=\"%s\"," % self.get_charset_encoding())
        self.writeln(u"  ];")
        self.flush()
198661
def output(self):
        
        if not self.path_output:
            self.output_to_fd(sys.stdout)
        else:
            with open(self.path_output, "w") as out:
                self.output_to_fd(out)
175330
def start(self):
        """"""

        if self.log_filename:
            print('Output will be logged to `%s`.' % self.log_filename)

        start_time = time.strftime(self.timestamp_fmt)
        print('Started %s' % start_time)

        if self.log_filename:
            orig_stdout = sys.stdout
            orig_stderr = sys.stderr

            sys.stdout = self.log_file
            sys.stderr = self.log_file

            print('Started %s' % start_time)

        doit_main = DoitMain(self)
        doit_main.run(['run'])

        stop_time = time.strftime(self.timestamp_fmt)

        if self.log_filename:
            print('Stopped %s' % stop_time)
            print()

            sys.stdout = orig_stdout
            sys.stderr = orig_stderr
            self.log_file.close()

        print('Stopped %s' % stop_time)
1057477
def output_capturing():
    """"""
    out = sys.stdout

    sys.stdout = StringIO()

    try:
        yield

    finally:
        sys.stdout = out
1364321
def write(self, output):
        
        self._stream.write(output)

        if self._auto_flush:
            self._stream.flush()
1128049
def record_process(self, process, prg=''):
        
        self._log(self.logFileProcess, force_to_string(process), prg)
81109
def write(self, data, end="\n", flush=True):
        
        if not self.nostdout:
            self.stdout.write(data+end)
        if self.file is not None:
            self.file.write(data+end)
        if flush:
            self.flush()
53655
def run(self):
        """"""
        notice('Starting output thread', self.color)
        o = Thread(target=self.__output_thread, name='output')
        o.start()
        self.threads.append(o)
        try:
            notice('Starting input thread', self.color)
            self.__input_thread()
        except KeyboardInterrupt:
            self.__shutdown()
60577
def _on_process_finished(self):
        
        exit_code = self._process.exitCode()
        if self._process.exitStatus() != self._process.NormalExit:
            exit_code = 139
        self._formatter.append_message('\x1b[0m\nProcess finished with exit code %d' % exit_code,
                                       output_format=OutputFormat.CustomFormat)
        self.setReadOnly(True)
        self.process_finished.emit()
1165155
def write_eof(self):
        """"""
        self._check_status()
        if not self._writable:
            raise TransportError('transport is not writable')
        if self._closing:
            raise TransportError('transport is closing')
        try:
            self._handle.shutdown(self._on_write_complete)
        except pyuv.error.UVError as e:
            self._error = TransportError.from_errno(e.args[0])
            self.abort()
            raise compat.saved_exc(self._error)
        self._write_buffer_size += 1
613607
def do_write(self, msg):
        """"""
        self.stream = self.do_open()
        stream = self.stream
        stream.write(msg)
        if self.terminator:
            stream.write(self.terminator)
        stream.flush()
        self._close()
        return