@ai-ecoverse/slicc-agent 3.42.2 → 3.42.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/agent +6 -6
- package/package.json +1 -1
package/bin/agent
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/bin/bash
|
|
2
2
|
dir=/var/lib/slicc/agent/requests
|
|
3
|
-
as
|
|
3
|
+
as="${0##*/}"
|
|
4
4
|
case "$as" in subagent|sprinkle|memory|gelatiere|freezer|models|panel) ;; *) as=agent ;; esac
|
|
5
|
-
mkdir -p "$dir/in" "$dir/out" 2>/dev/null
|
|
5
|
+
[ -d "$dir/in" ] && [ -d "$dir/out" ] || mkdir -p "$dir/in" "$dir/out" 2>/dev/null
|
|
6
6
|
who="${SLICC_AGENT:-}"
|
|
7
7
|
if [ -z "$who" ] && [ -n "${SLICC_TAB:-}" ]; then who="tab:$SLICC_TAB"; fi
|
|
8
8
|
|
|
@@ -22,7 +22,7 @@ for arg in "$@"; do
|
|
|
22
22
|
if [ "$arg" = "-" ]; then stdin=1; fi
|
|
23
23
|
done
|
|
24
24
|
|
|
25
|
-
id="$
|
|
25
|
+
id="${EPOCHREALTIME/[.,]/}-$$-$RANDOM"
|
|
26
26
|
submit "$id" "$@" || exit 1
|
|
27
27
|
stdin=0
|
|
28
28
|
|
|
@@ -33,7 +33,7 @@ case "${1:-}" in
|
|
|
33
33
|
esac
|
|
34
34
|
|
|
35
35
|
cancel() {
|
|
36
|
-
submit "$
|
|
36
|
+
submit "${EPOCHREALTIME/[.,]/}-$$-$RANDOM" __cancel "$id"
|
|
37
37
|
exit 130
|
|
38
38
|
}
|
|
39
39
|
if [ $sync = 1 ]; then trap cancel TERM INT HUP; fi
|
|
@@ -64,11 +64,11 @@ while [ ! -f "$dir/out/$id.code" ]; do
|
|
|
64
64
|
exit 1
|
|
65
65
|
fi
|
|
66
66
|
if [ -n "$after" ] && [ $count -ge $((after * 10)) ]; then
|
|
67
|
-
submit "$
|
|
67
|
+
submit "${EPOCHREALTIME/[.,]/}-$$-$RANDOM" __detach "$id"
|
|
68
68
|
after=""
|
|
69
69
|
fi
|
|
70
70
|
done
|
|
71
|
-
code
|
|
71
|
+
read -r code < "$dir/out/$id.code"
|
|
72
72
|
if [ -f "$dir/out/$id.err" ]; then
|
|
73
73
|
cat "$dir/out/$id.out"
|
|
74
74
|
cat "$dir/out/$id.err" >&2
|
package/package.json
CHANGED