-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
582 changed files
with
8,923 additions
and
7,482 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,16 @@ | ||
# nhds/jobs | ||
A Distributed Task Manager | ||
# ⚡ Neighborhoods Kōjō ⚡ | ||
# 工場 | ||
A distributed task manager. | ||
|
||
* Including `NHDS\Jobs` with your project with composer | ||
```bash | ||
$ composer require nhds/jobs | ||
``` | ||
|
||
* Running the `NHDS\Jobs` service | ||
```bash | ||
$ vendor/bin/jobs process:pool:server:start $PWD/PATH/TO/services.yaml | ||
``` | ||
### `Kōjō` is a collection of the following components: | ||
* Distributed task management. | ||
* Distributed, cooperative, process-aware semaphores and mutex's. | ||
* Static cron scheduling. | ||
* Multi-process model. | ||
* Status system. | ||
* Distributed IPC. | ||
|
||
* Running an exmaple | ||
### Example usage | ||
```bash | ||
$ vendor/bin/phpunit --filter Foreman | ||
$ vendor/bin/jobs process:pool:server:start $PWD/example/config/root.yaml | ||
``` | ||
$ bin/kojo process:pool:server:start $PWD/example | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
#!/usr/bin/env php | ||
<?php | ||
declare(strict_types=1); | ||
ini_set('assert.exception', '1'); | ||
error_reporting(E_ALL); | ||
|
||
use Neighborhoods\Kojo\Console\Command\Process\Pool\Server\Start; | ||
use Neighborhoods\Pylon\DependencyInjection\ContainerBuilder\Facade; | ||
use Symfony\Component\Finder\Finder; | ||
|
||
if (PHP_SAPI !== 'cli') { | ||
echo 'bin/kojo must be run as a CLI application'; | ||
exit(1); | ||
} | ||
try{ | ||
foreach ([ | ||
__DIR__ . '/../../../autoload.php', | ||
__DIR__ . '/../vendor/autoload.php', | ||
] as $autoLoaderFilePathCandidate) { | ||
if (file_exists($autoLoaderFilePathCandidate)) { | ||
require_once $autoLoaderFilePathCandidate; | ||
break; | ||
} | ||
} | ||
}catch(\Exception $exception){ | ||
echo 'Autoload error: ' . $exception->getMessage(); | ||
exit(1); | ||
} | ||
$containerBuilderFacade = new Facade(); | ||
$discoverableDirectories[] = __DIR__ . '/../src'; | ||
$finder = new Finder(); | ||
$finder->name('*.yml'); | ||
if (isset($argv[2]) && is_string($argv[2]) && is_dir($argv[2])) { | ||
$discoverableDirectories[] = $argv[2]; | ||
}elseif (isset($argv[1]) && is_string($argv[1]) && $argv[1] === Start::OPT_RUN_SERVER) { | ||
foreach ($argv as $argument) { | ||
if (strstr($argument, Start::OPT_YSDP) !== false) { | ||
$ymlServicesFilePath = explode(Start::OPT_YSDP, $argument); | ||
$discoverableDirectories[] = $ymlServicesFilePath[1]; | ||
} | ||
} | ||
$finder->files()->in($discoverableDirectories); | ||
$containerBuilderFacade->addFinder($finder); | ||
$server = $containerBuilderFacade->getContainerBuilder()->get('process.pool.server'); | ||
$server->setParentProcessPath(''); | ||
$server->start(); | ||
exit(); | ||
} | ||
$finder->files()->in($discoverableDirectories); | ||
$containerBuilderFacade->addFinder($finder); | ||
$containerBuilder = $containerBuilderFacade->getContainerBuilder(); | ||
$consoleApplication = $containerBuilder->get('neighborhoods.kojo.symfony.component.console.application'); | ||
$consoleApplication->run(); | ||
|
||
return; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
{ | ||
"name": "nhds/jobs", | ||
"name": "neighborhoods/kojo", | ||
"type": "library", | ||
"description": "NHDS Jobs is meant to solve the problem of easily writing distributed, fast, fault tolerant tasks.", | ||
"description": "Neighborhoods Kōjō is a distributed task manager.", | ||
"license": "proprietary", | ||
"keywords": [], | ||
"authors": [ | ||
|
@@ -10,38 +10,44 @@ | |
"email": "[email protected]" | ||
} | ||
], | ||
"repositories": [ | ||
{ | ||
"type": "composer", | ||
"url": "https://satis.neighborhoods.com" | ||
} | ||
], | ||
"require": { | ||
"php": ">=7.1", | ||
"symfony/filesystem": "^4.0", | ||
"symfony/config": "^4.0", | ||
"symfony/yaml": "^4.0", | ||
"symfony/dependency-injection": "^4.0", | ||
"symfony/expression-language": "^4.0", | ||
"symfony/cache": "^4.0", | ||
"symfony/console": "^4.0", | ||
"symfony/finder": "^4.0", | ||
"zendframework/zend-db": "^2.8", | ||
"dragonmantank/cron-expression": "^2.0", | ||
"symfony/filesystem": "~4.0.3", | ||
"symfony/config": "~4.0.3", | ||
"symfony/yaml": "~4.0.3", | ||
"symfony/dependency-injection": "~4.0.3", | ||
"symfony/expression-language": "~4.0.3", | ||
"symfony/cache": "~4.0.3", | ||
"symfony/console": "~4.0.3" | ||
"ocramius/proxy-manager": "^2.1", | ||
"neighborhoods/pylon": "dev-master" | ||
}, | ||
"require-dev": { | ||
"phpunit/phpunit": "^6.4", | ||
"phpunit/dbunit": "^3.0", | ||
"symfony/finder": "^4.0" | ||
"phpunit/phpunit": "^7.0", | ||
"phpunit/dbunit": "^4.0", | ||
"neighborhoods/scaffolding": "dev-master" | ||
}, | ||
"bin": [ | ||
"src/bin/jobs", | ||
"src/bin/server" | ||
"bin/kojo" | ||
], | ||
"autoload": { | ||
"psr-4": { | ||
"NHDS\\Jobs\\": "src", | ||
"NHDS\\Toolkit\\": "nhdstoolkitsrc" | ||
"Neighborhoods\\Kojo\\": "src" | ||
} | ||
}, | ||
"autoload-dev": { | ||
"psr-4": { | ||
"NHDS\\Jobs\\Test\\": "tests", | ||
"NHDS\\Watch\\": "nhdswatchsrc", | ||
"NHDS\\Jobs\\Example\\": "example" | ||
"Neighborhoods\\Kojo\\Test\\": "tests", | ||
"Neighborhoods\\Kojo\\Example\\": "example" | ||
} | ||
} | ||
} |
Oops, something went wrong.