~aleteoryx/employ

ref: 9e576798985200e4ae81e552b52b17ff52790074 employ/PLAN -rw-r--r-- 1.4 KiB
9e576798Aleteoryx better heuristics 4 days ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
a job is:
	- id
	- executable data
	- marking: new/taken/done/failed
	- dates: created, taken, finished
	- metadata: dict[str,str]
		keys cannot include : or ' ', neither can include \n

server protocol:
	case-insensitive commands separated by \n
	on error, send back '?', else send back 'OKAY'
	commands which allow [job id] or [for job id] to be omitted
	will operate implicitly on the last-mentioned job, or error if
	there is none

server verbs:
	- ''
		ignored
	- NEW JOB len
		server reads in len bytes, and sends back a job id
	- LIST marking? JOBS
		server sends back a list of all jobs, in the format:
			id\tcreated\tlen\tmarking
	- INFO [FOR JOB id] IS
		server sends back a response of the form:
			SCRIPT IS len BYTES
			MARKED AS marking
			CREATED|TAKEN|FINISHED|UPDATED AT iso-8601
	- SCRIPT [FOR JOB id] IS len?
		get the script as len\ndata, or update the script.
		if a job is not marked 'new', the update fails
			
	- META [FOR JOB id] IS
		get metadata for id as key: value lines, terminated with a blank line
	- META key [FOR JOB id] IS value?
		set/get id.key. nil is returned as a blank line.
	- META key [FOR JOB id] CLEAR
		clear a metadata key

	- TAKE [JOB id]
		mark a job as taken, record timestamp
	- TAKE JOB
		take the first available job. if none is available, error.
	- MARK [JOB n] AS marking
		mark a job as complete, record timestamp
	- CANCEL [JOB n]
		delete a job from the job queue

	- all others:
		send back ?