-
Notifications
You must be signed in to change notification settings - Fork 160
/
element-process.go
76 lines (54 loc) · 1.56 KB
/
element-process.go
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
package man
import (
. "github.com/gocircuit/circuit/gocircuit.org/render"
)
func RenderElementProcessPage() string {
figs := A{
"FigMkProc": RenderFigurePngSvg("Process elements execute OS processes on behalf of the user.", "mkproc", "600px"),
}
return RenderHtml("Circuit process element", Render(processBody, figs))
}
// <h2>Using the Go API for process elements</h2>
// <p>To create and manipulate process elements, one needs to import the circuit's Go client API:
// <pre>
// import "github.com/gocircuit/circuit/client"
// </pre>
// <p>Let <code>client</code>, of type <code>*client.Client</code>, be an already established
// connection to the circuit cluster.
const processBody = `
<h2>Example: Make a process</h2>
<p>Here are a few examples. To run a new process on some chosen
cluster machine, first see what machines are available:
<pre>
circuit ls /...
/X88550014d4c82e4d
/X938fe923bcdef2390
</pre>
<p>Run a new <code>ls</code> process:
<pre>
circuit mkproc /X88550014d4c82e4d/pippi << EOF
{
"Path": "/bin/ls",
"Args":["/"]
}
EOF
</pre>
{{.FigMkProc}}
<p>See what happened:
<pre>
circuit peek /X88550014d4c82e4d/pippi
</pre>
<p>Close the standard input to indicate no intention to write to it:
<pre>
cat /dev/null | circuit stdin /X88550014d4c82e4d/pippi
</pre>
<p>Read the output (note that the output won't show until you close
the standard input first, as shown above):
<pre>
circuit stdout /X88550014d4c82e4d/pippi
</pre>
<p>Remove the process element from the anchor hierarchy
<pre>
circuit scrub /X88550014d4c82e4d/pippi
</pre>
`