Skip to content
This repository was archived by the owner on Jul 10, 2019. It is now read-only.

Command Line Interface

Paweł Jacewicz edited this page Dec 20, 2012 · 2 revisions

hc utility

Console utility, called hc is a part of the HSN 2.0 system. It can be used to manage and monitor HSN from a command-line. While it may look less appealing, its functionality supersedes that of a Web UI. hc also contains help text, which can be accessed using -h or --help switch at the end.

General information

hc can be used with a number of subcommands. Each of them can either be used by its long name (e.g. job) or by its shortcut (e.g. j - letter in bold in the tables below). Subcommand also have its help text, which can be retrieved by using the -h or --help switch. These subcommands are:

job

Job management and monitoring: submitting, detailed information and list.

workflow

Workflow management: sending, retrieving and getting status information.

config

Configuration management.

ping

Checking framework status.

Job management and monitoring

To perform job related command write hc job <subcommand> <parameters> (or hc j <subcommand> <parameters>). Available subcommands are:

list

Lists all jobs that started since the last framework startup.

details <job_id>

Prints details about a job present on a job list.

submit <workflow> <parameters>

Creates a new job, based on a worfklow template and parameters to that template.

Examples

Following is the usual series of commands that you will use to submit and monitor a job:

$ hc j s example feeder.uri=/tmp/links.txt
The job descriptor (workflow=webclient) is outgoing...
The job has been accepted. (Id=1097)
$ hc j l
Found 2 job(s):
   id: 1097 status: PROCESSING
   id: 1096 status: COMPLETED
$ hc j d 1097
Job details called
Details about the job:
   job_status	PROCESSING
   task_count_webclient	18635/69986
   job_start_time	2012-12-13 12:48:04
   job_custom_params	{feeder={uri=/tmp/links.txt}}
   job_started_subprocess_count	89848
   task_count_feeder-list	1/1
   task_count_reporter	38413/38413
   job_processing_time_sec	120
   task_count_js-sta	37408/37408
   job_workflow_revision	ff5426656e003bf5d1b898c72ecf9e6cc4b4cd59
   task_count_shell-scdbg	1088/1088
   job_workflow_name	example
   job_active_subprocess_count	54588
   job_active_step	wait
   task_count_swf-cve	1005/1005

Workflow management

This is the most complex part of hc. It support following subcommands:

list

Lists all workflows in the workflow repository.

get [-f <file>]

Prints or saves the workflow to file.

upload <name> [-f <file>]

Uploads new workflow to the repository. Uses either standard input or file. Workflow will have name name.

disable <name>

Disables workflow name.

enable <name>

Enables workflow name.

history <name>

Lists workflow commits history.

status <name>

Displays the current workflow status (comments, validity, is it enabled or not).

Examples

Normally, you would only want to list and upload workflows. This can be achieved using:

$ hc w l
The list workflows is outgoing...
Found 3 workflow(s):
	  name:	abc
	  enabled: True

	  name:	abc2
	  enabled: True

	  name:	bad
	  enabled: False
$ hc w u -f test workflow.hwl
Uploading workflow to framework.
Workflow uploaded as revision f395a08aeabc09f132e64b19470cd81a47c4653b

Configuration management

For now you can only view the current configuration used by framework using the subcommand get.

Examples

hc c g
Config get request called
   AMQP.queues.objectStore.high	os:h
   AMQP.server.address	127.0.0.1
   AMQP.queues.objectStore.low	os:l
   AMQP.services	feeder-list webclient capture swf-cve shell-scdbg js-sta reporter norm-url rb-officecat rb-pdffox
   AMQP.queues.framework.high	fw:h
   workflow.repository	/etc/hsn2/workflows/
   AMQP.queues.framework.low	fw:l
   jobs.sequence.file	/opt/hsn2/framework/jobId.seq

Ping

Pinging the framework checks its current status. Most of the time you would get two types of responses:

$ hc p
The ping is outgoing...
The framework is alive.

or, when framework is not running or not responding, you will get something similar to:

$ hc p
The ping is outgoing...
2012-12-14 12:30:53,924 ERROR    Response timeout
ERROR:HC:Response timeout
ERROR: Response wait timeout

Clone this wiki locally