Signal handling for sidecars logs.
427172
def logs_sidecars_jobs(job_uuid: str,
                       job_name: str,
                       log_lines: Optional[Union[str, Iterable[str]]]) -> None:
    """"""
    handle_job_logs(job_uuid=job_uuid,
                    job_name=job_name,
                    log_lines=log_lines)
    publisher.publish_job_log(
        log_lines=log_lines,
        job_uuid=job_uuid,
        job_name=job_name,
        send_task=False
    )
1167037
def _handle_log_rotations(self):
        '''  '''
        for h in self.capture_handlers:
            if self._should_rotate_log(h):
                self._rotate_log(h)
1222531
def signal_handler_mapping(self):
    """"""
    # Could use an enum here, but we never end up doing any matching on the specific signal value,
    # instead just iterating over the registered signals to set handlers, so a dict is probably
    # better.
    return {
      signal.SIGINT: self.handle_sigint,
      signal.SIGQUIT: self.handle_sigquit,
      signal.SIGTERM: self.handle_sigterm,
    }
138085
function loggingMiddleware(req, res, next) {
  logRequest(req, res);
  setupResponseInterceptors(req, res);
  next();
}
509553
def ecuc_extract_signal(signal_node, ns):
    # type: (_Element, str) -> canmatrix.Signal
    """"""
    attributes = signal_node.findall(".//" + ns + "DEFINITION-REF")  # type: typing.Sequence[_Element]
    start_bit = None
    size = 0
    is_little = False
    # endianness = None
    # init_value = 0
    # signal_type = None
    # timeout = 0
    for attribute in attributes:
        if attribute.text.endswith("ComBitPosition"):
            start_bit = int(attribute.getparent().find(".//" + ns + "VALUE").text)
        if attribute.text.endswith("ComBitSize"):
            size = int(attribute.getparent().find(".//" + ns + "VALUE").text)
        if attribute.text.endswith("ComSignalEndianness"):
            endianness = attribute.getparent().find(".//" + ns + "VALUE").text
            is_little = "LITTLE_ENDIAN" in endianness
        if attribute.text.endswith("ComSignalInitValue"):
            init_value = int(attribute.getparent().find(".//" + ns + "VALUE").text)
        if attribute.text.endswith("ComSignalType"):
            signal_type = attribute.getparent().find(".//" + ns + "VALUE").text
        if attribute.text.endswith("ComTimeout"):
            timeout = int(attribute.getparent().find(".//" + ns + "VALUE").text)
    return canmatrix.Signal(get_element_name(signal_node, ns), start_bit=start_bit, size=size, is_little_endian=is_little)
841295
def signal_handler(sig, frame):
    
    for client in connected_clients[:]:
        if client.is_asyncio_based():
            client.start_background_task(client.disconnect, abort=True)
        else:
            client.disconnect(abort=True)
    return original_signal_handler(sig, frame)
928680
protected void handleMessage(VehicleMessage message) {
        if(message != null) {
            message.timestamp();
            if(mCallback != null) {
                mCallback.receive(message);
            }
        }
    }
1315199
public function doWork()
    {
        /**
         * Installing signal handlers
         */
        $this->cliHelper->writeTimeLine('Setting up signal handlers...');
        declare(ticks = 1);
    
        pcntl_signal(SIGTERM, array($this, 'shutdownProcesses'));
        pcntl_signal(SIGINT, array($this, 'shutdownProcesses'));
        pcntl_signal(SIG_IGN, array($this, 'shutdownProcesses'));
        pcntl_signal(SIGHUP, array($this, 'shutdownProcesses'));
    
        pcntl_signal(SIGCHLD, array($this, 'startCrashedProcess'));
    
        /**
         * Starting processes
         */
        $this->cliHelper->writeTimeLine('Starting processes...');
        foreach ($this->tasks as $task) {
            for ($i = 0; $i < $task->getInstances(); $i++) {
                $this->startProcess($task);
            }
        }
    
        /**
         * Monitoring processes and restart after the specified time
         */
        $this->cliHelper->writeTimeLine('Monitoring processes...');
        while (true) {
            foreach ($this->processes as $process) {
                /**
                 * If runtime for one process is reached, kill him and restart
                 */
                if ($process->getRestartTime() < time()) {
                    $this->restartProcess($process);
                }
            }
    
            sleep(1);
        }
    }
1018178
public void signal(Signal signal, CmsUUID id) {

        getStatus(id).handleSignal(signal);
        runSelectionChangeAction();
    }
486695
def post_transport_log(self, call):
        """"""
        output = "Returned Data: \n{}".format(call.result)
        LOGGER.debug(output)
936110
public void handleSignal(Signal signal) {

        switch (signal) {
            case publish:
                signalPublish();
                break;
            case unpublish:
                signalUnpublish();
                break;
            case remove:
                signalRemove();
                break;
            case unremove:
                signalUnremove();
                break;
            default:
                break;
        }
        m_handler.update(m_id, this);
    }
361172
def handle_signal(self, sig, frame):
        """"""
        if sig in [signal.SIGINT]:
            log.warning("Ctrl-C pressed, shutting down...")
        if sig in [signal.SIGTERM]:
            log.warning("SIGTERM received, shutting down...")
        self.cleanup()
        sys.exit(-sig)
226413
def plot_signal(signal, sig_len, n_sig, fs, time_units, sig_style, axes):
    ""

    # Extend signal style if necesary
    if len(sig_style) == 1:
        sig_style = n_sig * sig_style

    # Figure out time indices
    if time_units == 'samples':
        t = np.linspace(0, sig_len-1, sig_len)
    else:
        downsample_factor = {'seconds':fs, 'minutes':fs * 60,
                             'hours':fs * 3600}
        t = np.linspace(0, sig_len-1, sig_len) / downsample_factor[time_units]

    # Plot the signals
    if signal.ndim == 1:
        axes[0].plot(t, signal, sig_style[0], zorder=3)
    else:
        for ch in range(n_sig):
            axes[ch].plot(t, signal[:,ch], sig_style[ch], zorder=3)
256084
function broadcastMonitors(records, moduleId, msg) {
    msg = protocol.composeRequest(null, moduleId, msg);

    if (records instanceof Array) {
        for (let i = 0, l = records.length; i < l; i++) {
            const socket = records[i].socket;
            doSend(socket, 'monitor', msg);
        }
    } else {
        for (const id in records) {
            if (records.hasOwnProperty(id)) {
                const socket = records[id].socket;
                doSend(socket, 'monitor', msg);
            }
        }
    }
}
417390
def _setup_signal_handler(self):
        
        signal.signal(signal.SIGTERM, self._signal_handler)
        signal.signal(signal.SIGINT, self._signal_handler)
        signal.signal(signal.SIGQUIT, self._signal_handler)
1128283
protected function logRouteCancellation()
    {
        $message = sprintf("<warning>Canceled routing to</warning> -> <info>%s#%s</info>", get_class($this->controller), $this->action);

        $logger = Strata::app()->getLogger();
        if ($logger) {
            $logger->log($message, "<green>Route</green>");
        }
    }
4195
public static void register(final Logger LOG) {
		synchronized (SignalHandler.class) {
			if (registered) {
				return;
			}
			registered = true;

			final String[] SIGNALS = OperatingSystem.isWindows()
				? new String[]{ "TERM", "INT"}
				: new String[]{ "TERM", "HUP", "INT" };
			
			StringBuilder bld = new StringBuilder();
			bld.append("Registered UNIX signal handlers for [");
			
			String separator = "";
			for (String signalName : SIGNALS) {
				try {
					new Handler(signalName, LOG);
					bld.append(separator);
					bld.append(signalName);
					separator = ", ";
				} catch (Exception e) {
					LOG.info("Error while registering signal handler", e);
				}
			}
			bld.append("]");
			LOG.info(bld.toString());
		}
	}