kapitchi/process

Long time execution script updates. Get stdout of long running script from another process!

dev-master 2013-07-07 14:30 UTC

This package is not auto-updated.

Last update: 2024-04-27 11:00:30 UTC


README

Version: 0.1-dev
Author: Kapitchi Team
Website: http://kapitchi.com
Demo: http://kapitchi.com/showcase

README.md status: INCOMPLETE

Licence

LGPLv3
The GNU Lesser General Public License, version 3.0

Introduction

Primary usage of this module is running long time operations "in background" and being able to receive progress updates.

Installation

TODO

Basic Usage

  1. Register a process/job you want to run - you get a process ID / pid.
$process = $processor->registerJob(new \KapitchiProcess\Job\ShellJob('ping -n 30 kapitchi.com'));
$pid = $process->getId();
  1. Run a process using separate AJAX request as to get response will take as long as your process runs
$processor->run($pid);
  1. Use /process/api/bus-reader/read-next/[pid] (AJAX every 1sec?) to request process updates in JSON format as an example below.

stdoutDelta contains data written by the process to "stdOut" after the last progress request only.

{
    processId: "895472f28183dc67d39d9680d93c8e9a",
    isFinished: false,
    isStarted: true,
    startedTime: 1366660603,
    runningTime: 24,
    registry: [ ],
    stdoutDelta: "Reply from 176.74.179.134: bytes=32 time=415ms TTL=38 Reply from 176.74.179.134: bytes=32 time=416ms TTL=38 Reply from 176.74.179.134: bytes=32 time=415ms TTL=38 Reply from 176.74.179.134: bytes=32 time=416ms TTL=38 "
}

TODO