SourceForge.net Logo

CGRU

LinkedIn
Since 1.6.7 (at 2012.12.03) site moved to cgru.info

Afanasy JSON


You can communicate with Afanasy server by JSON.

  • afcmd json [file|pipe] - Test JSON syntax, output an error and position.
  • afcmd v json [file|pipe] - Same as previous and output parsed JSON document structure.
  • afcmd json send [file] - Send JSON data after successfully parsed.

You can use Afanasy Python module to construct and send valid structures.

JSON protocol is not finished. Only job structure is final - to remove python binary module dependence to send a job.

Job Mininum:


{
	"job":
	{
		"name"                  : "job name",
		"user_name"             : "jimmy",
		"host_name"             : "host",
		"blocks":[
		{
			"name"              : "Nuke",
			"tasks_name"        : "frames @#@-@#@",
			"service"           : "nuke",
			"parser"            : "nuke",
			"frame_first"       : 1,
			"frame_last"        : 100,
			"frames_per_task"   : 10,
			"frames_inc"        : 2,
			"command"           : "nuke -F@#@,@#@ -x scene.nk -X Write1",
			"working_directory" : "/home/jimmy/work",
			"files"             : "folder/img_L.@####@.jpg;folder/img_R.@####@.jpg"
		}
		]
	}
}

Get Examples:

Get all jobs list Get jobs list from users ids with Get renders by hostnames pattern Get users list with special ids
{
 "get":
 {
  "type" : "jobs"
 }
}

{
 "get":
 {
  "type" : "jobs",
  "uids" : [1,2]
 }
}
{
 "get":
 {
  "type" : "renders",
  "mask" : "farmhost.*"
 }
}
{
 "get":
 {
  "type" : "users",
  "ids"  : [1,2]
 }
}

Action Examples:

Edit parameters Perform operations
Set render nimby Set user priority Exit render Delete job
{
 "action":
 {
  "user_name"  : "jimmy",
  "host_name"  : "pc01",
  "mask"       : "pc02",
  "type"       : "renders",
  "params"     :
  {
   "nimby"     : true
  }
 }
}
{
 "action":
 {
  "user_name"  : "jimmy",
  "host_name"  : "pc01",
  "mask"       : "bob",
  "type"       : "users",
  "params"     :
  {
   "priority"  : "50"
  }
 }
}
{
 "action":
 {
  "user_name"  : "jimmy",
  "host_name"  : "pc01",
  "mask"       : "pc02",
  "type"       : "renders",
  "operation"  :
  {
   "type"      : "exit"
  }
 }
}
{
 "action":
 {
  "user_name"  : "jimmy",
  "host_name"  : "pc01",
  "mask"       : "my3drender",
  "type"       : "jobs",
  "operation"  :
  {
   "type"      : "delete"
  }
 }
}

Job Maximum:


{
	"job":
	{
		"name"                           : "job name",
		"user_name"                      : "jimmy",
		"annotation"                     : "json test",
		"priority"                       : 50,
		"max_running_tasks"              : 20,
		"max_running_tasks_per_host"     : 3,
		"time_creation"                  : 12345678901,
		"time_wait"                      : 12345688901,
		"time_life"                      : 360000,
		"description"                    : "\\for\\ \"tests\" 'only'",
		"hosts_mask"                     : "renderhost.*",
		"hosts_mask_exclude"             : "badhost.*",
		"depend_mask"                    : "my3djob.*",
		"depend_mask_global"             : "his3djob.*",
		"need_os"                        : "linux",
		"need_properties"                : "cuda",
		"command_post"                   : "deletefiles path/to/some.scene",
		"blocks":[
		{
			"name"                       : "Nuke",
			"tasks_name"                 : "frames @#@-@#@",
			"service"                    : "nuke",
			"parser"                     : "nuke",
			"capacity"                   : 500,
			"capacity_coeff_min"         : 2,
			"capacity_coeff_max"         : 4,
			"frame_first"                : 1,
			"frame_last"                 : 100,
			"frames_per_task"            : 10,
			"frames_inc"                 : 2,
			"non_sequential"             : true,
			"errors_retries"             : 9,
			"errors_avoid_host"          : 4,
			"errors_task_same_host"      : 3,
			"errors_forgive_time"        : 3600,
			"depend_mask"                : "someBlock",
			"tasks_depend_mask"          : "someBlockTasks",
			"hosts_mask"                 : "renderhost_b.*",
			"hosts_mask_exclude"         : "badhost_b.*",
			"need_properties"            : "nvidia",
			"command"                    : "nuke -F@#@,@#@ -x scene.nk -X Write1",
			"working_directory"          : "/home/jimmy/work",
			"files"                      : "folder/img_L.@####@.jpg;folder/img_R.@####@.jpg",
			"command_post"               : "deletefiles scene.nk"
		},
		{
			"name"                       : "Generic",
			"tasks_name"                 : "generate @#@",
			"service"                    : "generic",
			"parser"                     : "generic",
			"capacity"                   : 1100,
			"depend_sub_task"            : true,
			"max_running_tasks"          : 20,
			"max_running_tasks_per_host" : 3,
			"tasks_max_run_time"         : 600,
			"multihost_min"              : 3,
			"multihost_max"              : 5,
			"multihost_max_wait"         : 10,
			"multihost_service"          : "generic_server",
			"multihost_service_wait"     : 3,
			"multihost_master_on_slave"  : false,
			"command"                    : "generate @#@",
			"working_directory"          : "/home/jimmy/work",
			"files"                      : "folder/@#@.jpg",
			"tasks":[
			{
				"name"                   : "Process A",
				"command"                : "-a file_a",
				"files"                  : "file_a"
			},
			{
				"name"                   : "Process B",
				"command"                : "-b file_b",
				"files"                  : "file_b"
			},
			{
				"name"                   : "Process C",
				"command"                : "-c file_c",
				"files"                  : "file_c"
			}
			]
		}
		]
	}
}

Since 1.6.7 (at 2012.12.03) site moved to cgru.info
SourceForge.net Project

CGRU

Libre Graphics World