FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

AC7ION/experts-task: A task to minimize experts & their costs · GitHub

Latest commit

 

History

17 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Experts minimization task

Command Line Application with common features built using phalcon framework. More info could be found here

Requirements

PHP 5.4 or greater

Required PHP Modules

To check if phalcon module is installed/enabled for CLI use

$ php -m | grep -i "phalcon"
phalcon

Input file structure

(number of directions) (number of experts)
(couldSolve matrix)
(costs array)

Example:

20 6
0 0 1 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 1
0 1 0 1 0 0 0 0 0 1 0 0 1 0 0 0 0 1 0 0
1 0 0 0 1 0 1 1 0 0 1 1 0 0 1 0 1 0 1 1
0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
0 0 1 1 1 1 0 0 1 1 1 1 0 0 1 1 1 1 0 1
1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 1 0 1 0 1
10 20 30 5 40 11

Database Configuration

Open php-cli-app-phalcon/app/config.php and edit your database connection credentials

$settings = array(
        'database' => array(
                'adapter' => 'Mysql',   /* Possible Values: Mysql, Postgres, Sqlite */
                'host' => 'your_ip_or_hostname',
                'username' => 'your_user',
                'password' => 'your_password',
                'name' => 'your_database_schema',
                'port' => 3306
        ),
);

Import the tables into your MySQL Server

mysql -u root -p your_database_schema < php-cli-app-phalcon/schema/mysql.data.sql

Import the tables into your Postgres Server

psql -U root -W -f postgres.data.sql your_database_schema

Command Line Examples

General Syntax for running a task/job (Note: only Task is required)

cd php-cli-app-phalcon/private 
php cli.php [Task] [Action] [Param1] [Param2] [...]

Tasks are stored in php-cli-app-phalcon/app/tasks directory. The following example task is named ExampleTask.php. Basic example of how to kick off a cli job/task.

cd php-cli-app-phalcon/private
php cli.php Example test1 

Passing parameters to your application

php cli.php Example test2 bob sanders 

Special Flags

Enable debug mode to see a more detailed overview of what is going on --debug This also enables a more verbose level of php reporting, displaying all php warnings.

php cli.php Example cmd --debug

Record all output to the database (in the task table) --record .

php cli.php Example test1 --record

Only allow 1 instance to run at a time --single

php cli.php Example test1 --single

Enable all flags

php cli.php Example test1 --debug --record --single

Adding New Tasks

Go to php-cli-app-phalcon/app/tasks directory. This is where all the tasks are stored. Just go ahead and create a new file here (eg. NewTask.php)

<?php

namespace Tasks;

use \Cli\Output as Output;

class NewTask extends \Phalcon\Cli\Task {

    public function workAction() {
        Output::stdout("hi");
    }
}
?>

Now run it!

cd php-cli-app-phalcon/private
php cli.php New work

Adding New Classes to Autoload

Note: All classes must be namespaced if you use the provided autoloader.

Open php-cli-app-phalcon/app/config/autoload.php and an element to the existing array. So, you have to use namespacing to load new classes.

$autoload = [
        'Utilities\Debug' => $dir . '/library/utilities/debug/',
	'Trend' => $dir . '/library/trend/'
];

return $autoload;

About

A task to minimize experts & their costs

Resources

Stars

0 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages


Back | FazBrowse Home | New Git URL