Compare commits
No commits in common. "c282e9c361ed3e149660cdd27bedb978ed312872" and "434152daba95cb8d724bda8cdc45ba9c7ca74c6a" have entirely different histories.
c282e9c361
...
434152daba
5
atom
5
atom
@ -429,7 +429,7 @@ echo '
|
||||
CREATE TEMPORARY TABLE tasks(
|
||||
id INTEGER PRIMARY KEY,
|
||||
requires INTEGER,
|
||||
required_by INTEGER DEFAULT 0,
|
||||
required INTEGER,
|
||||
status INTEGER NOT NULL,
|
||||
key TEXT UNIQUE,
|
||||
rename_pattern TEXT,
|
||||
@ -906,7 +906,8 @@ then
|
||||
FROM tasks
|
||||
INNER JOIN source_files
|
||||
ON tasks.source_file=source_files.id
|
||||
WHERE tasks.status = 2;
|
||||
WHERE tasks.status = 2
|
||||
AND requires is NULL;
|
||||
|
||||
SELECT "AtOM:NoMoreFiles";' >&3
|
||||
read -u4 line
|
||||
|
||||
@ -11,7 +11,7 @@ openDatabase() {
|
||||
if (( debug > 2 ))
|
||||
then
|
||||
exec 5>&3
|
||||
exec 3> >(tee -a "$tempdir/debug.log" >&5)
|
||||
exec 3> >(tee -a $tempdir/debug.log >&5)
|
||||
fi
|
||||
cat $schema >&3
|
||||
echo '.separator ::AtOM:SQL:Sep::' >&3
|
||||
|
||||
@ -153,24 +153,18 @@ decodeFile() {
|
||||
done
|
||||
)
|
||||
status 0
|
||||
cleanup $tmpfile.wav
|
||||
EOInsert
|
||||
)
|
||||
progressSpin
|
||||
fi
|
||||
if (( sox_needed ))
|
||||
then
|
||||
cleanup="$tempdir/$tmpfile"
|
||||
decodeSox "$tempdir/$tmpfile.wav"
|
||||
if ! soxtaskid=$(
|
||||
Select tasks id <<<"key = $tmpfile"
|
||||
)
|
||||
then
|
||||
parent_required=$(
|
||||
Select tasks required_by \
|
||||
<<<"id = $decodetaskid"
|
||||
)
|
||||
Update tasks required_by $((++parent_required)) \
|
||||
<<<"id = $decodetaskid"
|
||||
soxtaskid=$(
|
||||
Insert tasks <<-EOInsert
|
||||
key $tmpfile
|
||||
@ -182,8 +176,9 @@ decodeFile() {
|
||||
done
|
||||
)
|
||||
requires $decodetaskid
|
||||
required $decodetaskid
|
||||
status 0
|
||||
cleanup $tmpfile.wav
|
||||
cleanup $cleanup
|
||||
EOInsert
|
||||
)
|
||||
progressSpin
|
||||
|
||||
@ -52,6 +52,7 @@ encodeFile::mp3() {
|
||||
Insert tasks <<-EOInsert
|
||||
key ${fileid}lame$destination
|
||||
requires ${soxtaskid:-$decodetaskid}
|
||||
required ${soxtaskid:-$decodetaskid}
|
||||
fileid $destfileid
|
||||
filename $destdir/$destfile.mp3
|
||||
$(
|
||||
@ -65,6 +66,7 @@ encodeFile::mp3() {
|
||||
echo "cmd_arg$key $cleanedopts"
|
||||
done
|
||||
)
|
||||
cleanup $tempdir/$tmpfile.wav
|
||||
source_file $fileid
|
||||
status 0
|
||||
rename_pattern ${destinationrenamepath[$destination]}/${destinationrename[$destination]}
|
||||
@ -72,12 +74,6 @@ encodeFile::mp3() {
|
||||
ascii ${destinationascii["$destination"]}
|
||||
EOInsert
|
||||
)
|
||||
parent_required=$(
|
||||
Select tasks required_by \
|
||||
<<<"id = ${soxtaskid:-$decodetaskid}"
|
||||
)
|
||||
Update tasks required_by $((++parent_required)) \
|
||||
<<<"id = ${soxtaskid:-$decodetaskid}"
|
||||
progressSpin
|
||||
soxtaskid=''
|
||||
}
|
||||
|
||||
@ -20,6 +20,7 @@ encodeFile::opus() {
|
||||
Insert tasks <<-EOInsert
|
||||
key ${fileid}opusenc$destination
|
||||
requires ${soxtaskid:-$decodetaskid}
|
||||
required ${soxtaskid:-$decodetaskid}
|
||||
fileid $destfileid
|
||||
filename $destdir/$destfile.opus
|
||||
$(
|
||||
@ -33,6 +34,7 @@ encodeFile::opus() {
|
||||
echo "cmd_arg$key $cleanedopts"
|
||||
done
|
||||
)
|
||||
cleanup $tempdir/$tmpfile.wav
|
||||
source_file $fileid
|
||||
status 0
|
||||
rename_pattern ${destinationrenamepath[$destination]}/${destinationrename[$destination]}
|
||||
@ -40,12 +42,6 @@ encodeFile::opus() {
|
||||
ascii ${destinationascii["$destination"]}
|
||||
EOInsert
|
||||
)
|
||||
parent_required=$(
|
||||
Select tasks required_by \
|
||||
<<<"id = ${soxtaskid:-$decodetaskid}"
|
||||
)
|
||||
Update tasks required_by $((++parent_required)) \
|
||||
<<<"id = ${soxtaskid:-$decodetaskid}"
|
||||
progressSpin
|
||||
soxtaskid=''
|
||||
}
|
||||
|
||||
@ -16,6 +16,7 @@ encodeFile::vorbis() {
|
||||
Insert tasks <<-EOInsert
|
||||
key ${fileid}oggenc$destination
|
||||
requires ${soxtaskid:-$decodetaskid}
|
||||
required ${soxtaskid:-$decodetaskid}
|
||||
fileid $destfileid
|
||||
filename $destdir/$destfile.ogg
|
||||
$(
|
||||
@ -29,6 +30,7 @@ encodeFile::vorbis() {
|
||||
echo "cmd_arg$key ${oggencopts[key]}"
|
||||
done
|
||||
)
|
||||
cleanup $tempdir/$tmpfile.wav
|
||||
source_file $fileid
|
||||
status 0
|
||||
rename_pattern ${destinationrenamepath[$destination]}/${destinationrename[$destination]}
|
||||
@ -36,12 +38,6 @@ encodeFile::vorbis() {
|
||||
ascii ${destinationascii["$destination"]}
|
||||
EOInsert
|
||||
)
|
||||
parent_required=$(
|
||||
Select tasks required_by \
|
||||
<<<"id = ${soxtaskid:-$decodetaskid}"
|
||||
)
|
||||
Update tasks required_by $((++parent_required)) \
|
||||
<<<"id = ${soxtaskid:-$decodetaskid}"
|
||||
progressSpin
|
||||
soxtaskid=''
|
||||
}
|
||||
|
||||
@ -4,6 +4,7 @@ gettaskinfos() {
|
||||
SELECT
|
||||
id,
|
||||
source_file,
|
||||
required,
|
||||
cleanup,
|
||||
fileid,
|
||||
filename
|
||||
@ -15,6 +16,8 @@ gettaskinfos() {
|
||||
rest="${line#*::AtOM:SQL:Sep::}::AtOM:SQL:Sep::"
|
||||
sourcefileid=${rest%%::AtOM:SQL:Sep::*}
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
required=${rest%%::AtOM:SQL:Sep::*}
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cleanup=${rest%%::AtOM:SQL:Sep::*}
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
destfileid=${rest%%::AtOM:SQL:Sep::*}
|
||||
|
||||
@ -1,9 +1,5 @@
|
||||
#!/bin/bash
|
||||
checkworkers() {
|
||||
local \
|
||||
taskid \
|
||||
parent_required \
|
||||
parent_task
|
||||
for key in ${!workers[@]}
|
||||
do
|
||||
if ! kill -0 ${workers[key]} 2>/dev/null
|
||||
@ -18,19 +14,6 @@ checkworkers() {
|
||||
failedtasks+=($taskid)
|
||||
(( ++failed ))
|
||||
fi
|
||||
parent_task=$(
|
||||
Select tasks requires \
|
||||
<<<"id = $taskid"
|
||||
)
|
||||
if (( parent_task ))
|
||||
then
|
||||
parent_required=$(
|
||||
Select tasks required_by \
|
||||
<<<"id = $parent_task"
|
||||
)
|
||||
Update tasks required_by $((--parent_required)) \
|
||||
<<<"id = $parent_task"
|
||||
fi
|
||||
unset workertasks[key]
|
||||
fi
|
||||
done
|
||||
|
||||
@ -1,23 +1,26 @@
|
||||
#!/bin/bash
|
||||
cleaner() {
|
||||
local \
|
||||
key \
|
||||
faildepends \
|
||||
taskid \
|
||||
count
|
||||
for key in ${!failedtasks[@]}
|
||||
do
|
||||
taskid=${failedtasks[key]}
|
||||
gettaskinfos $taskid
|
||||
faildepends=$(
|
||||
Select tasks required_by <<-EOWhere
|
||||
id = $taskid
|
||||
Select tasks 'COUNT(*)' <<-EOWhere
|
||||
requires = $taskid
|
||||
EOWhere
|
||||
)
|
||||
(( failed+=faildepends ))
|
||||
(( ran+=faildepends ))
|
||||
Update tasks status 2 <<<"id = $taskid"
|
||||
rm -f "$cleanup"
|
||||
echo "SELECT COUNT(*)
|
||||
FROM tasks
|
||||
WHERE ( status = 0 OR status = 1 )
|
||||
AND required = $taskid;">&3
|
||||
read -u4 count
|
||||
if (( count == 0 ))
|
||||
then
|
||||
rm -f "$cleanup"
|
||||
fi
|
||||
unset failedtasks[key]
|
||||
done
|
||||
for key in ${!finishedtasks[@]}
|
||||
@ -44,28 +47,29 @@ cleaner() {
|
||||
" FROM tasks" \
|
||||
" WHERE id=$taskid" \
|
||||
" )," \
|
||||
" fat32compat=(" \
|
||||
" fat32compat=(" \
|
||||
" SELECT fat32compat" \
|
||||
" FROM tasks" \
|
||||
" WHERE id=$taskid" \
|
||||
" )," \
|
||||
" ascii=(" \
|
||||
" SELECT ascii" \
|
||||
" ascii=(" \
|
||||
" SELECT ascii" \
|
||||
" FROM tasks" \
|
||||
" WHERE id=$taskid" \
|
||||
" )" \
|
||||
"WHERE id=$destfileid;" \
|
||||
>&3
|
||||
fi
|
||||
count=$(Select tasks required_by <<<"id = $taskid")
|
||||
echo "SELECT COUNT(*)
|
||||
FROM tasks
|
||||
WHERE ( status = 0 OR status = 1 )
|
||||
AND required = $taskid;">&3
|
||||
read -u4 count
|
||||
if (( count == 0 ))
|
||||
then
|
||||
[[ -n "$cleanup" ]] && rm -f "$tempdir/$cleanup"
|
||||
Delete tasks <<<"id = $taskid"
|
||||
unset finishedtasks[key]
|
||||
else
|
||||
Update tasks status 4 \
|
||||
<<<"id = $taskid"
|
||||
rm -f "$cleanup"
|
||||
fi
|
||||
Delete tasks <<<"id = $taskid"
|
||||
unset finishedtasks[key]
|
||||
done
|
||||
}
|
||||
|
||||
@ -1,145 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#!/bin/bash
|
||||
createworker() {
|
||||
(( ++active ))
|
||||
read -u4 line
|
||||
taskid=${line%%::AtOM:SQL:Sep::*}
|
||||
rest="${line#*::AtOM:SQL:Sep::}::AtOM:SQL:Sep::"
|
||||
sourcefileid=${rest%%::AtOM:SQL:Sep::*}
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cleanup=${rest%%::AtOM:SQL:Sep::*}
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
destfileid=${rest%%::AtOM:SQL:Sep::*}
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
destfilename=${rest%%::AtOM:SQL:Sep::*}
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
for key in ${!cmd_arg[@]}
|
||||
do
|
||||
[ -z "${cmd_arg[key]}" ] && unset cmd_arg[key]
|
||||
done
|
||||
workerid=$(getworkerid)
|
||||
workertasks[workerid]=$taskid
|
||||
Update tasks status 1 <<<"id = $taskid"
|
||||
worker $workerid &
|
||||
workers[$workerid]=$!
|
||||
}
|
||||
worker $1 &
|
||||
workers[$1]=$!
|
||||
}
|
||||
|
||||
@ -8,112 +8,7 @@ master() {
|
||||
SELECT COUNT(*)
|
||||
FROM tasks
|
||||
WHERE status = 0;
|
||||
'>&3
|
||||
|
||||
read -u4 remaining
|
||||
if (( remaining == 0 ))
|
||||
then
|
||||
sleep 0.1
|
||||
return 0
|
||||
fi
|
||||
|
||||
echo '
|
||||
SELECT COUNT(*)
|
||||
FROM tasks
|
||||
WHERE status = 0
|
||||
AND requires IN (
|
||||
SELECT id
|
||||
FROM tasks
|
||||
WHERE status = 4
|
||||
);
|
||||
|
||||
SELECT
|
||||
id,
|
||||
source_file,
|
||||
cmd_arg0,
|
||||
cmd_arg1,
|
||||
cmd_arg2,
|
||||
cmd_arg3,
|
||||
cmd_arg4,
|
||||
cmd_arg5,
|
||||
cmd_arg6,
|
||||
cmd_arg7,
|
||||
cmd_arg8,
|
||||
cmd_arg9,
|
||||
cmd_arg10,
|
||||
cmd_arg11,
|
||||
cmd_arg12,
|
||||
cmd_arg13,
|
||||
cmd_arg14,
|
||||
cmd_arg15,
|
||||
cmd_arg16,
|
||||
cmd_arg17,
|
||||
cmd_arg18,
|
||||
cmd_arg19,
|
||||
cmd_arg20,
|
||||
cmd_arg21,
|
||||
cmd_arg22,
|
||||
cmd_arg23,
|
||||
cmd_arg24,
|
||||
cmd_arg25,
|
||||
cmd_arg26,
|
||||
cmd_arg27,
|
||||
cmd_arg28,
|
||||
cmd_arg29,
|
||||
cmd_arg30,
|
||||
cmd_arg31,
|
||||
cmd_arg32,
|
||||
cmd_arg33,
|
||||
cmd_arg34,
|
||||
cmd_arg35,
|
||||
cmd_arg36,
|
||||
cmd_arg37,
|
||||
cmd_arg38,
|
||||
cmd_arg39,
|
||||
cmd_arg40,
|
||||
cmd_arg41,
|
||||
cmd_arg42,
|
||||
cmd_arg43,
|
||||
cmd_arg44,
|
||||
cmd_arg45,
|
||||
cmd_arg46,
|
||||
cmd_arg47,
|
||||
cmd_arg48,
|
||||
cmd_arg49,
|
||||
cmd_arg50,
|
||||
cmd_arg51,
|
||||
cmd_arg52,
|
||||
cmd_arg53,
|
||||
cmd_arg54,
|
||||
cmd_arg55,
|
||||
cmd_arg56,
|
||||
cmd_arg57,
|
||||
cmd_arg58,
|
||||
cmd_arg59,
|
||||
cleanup,
|
||||
fileid,
|
||||
filename
|
||||
FROM tasks
|
||||
WHERE status = 0
|
||||
AND requires IN (
|
||||
SELECT id
|
||||
FROM tasks
|
||||
WHERE status = 4
|
||||
ORDER BY source_file
|
||||
/* LIMIT 1 */
|
||||
)
|
||||
ORDER BY source_file
|
||||
LIMIT 1;
|
||||
'>&3
|
||||
|
||||
read -u4 ready
|
||||
if (( ready > 0 ))
|
||||
then
|
||||
createworker
|
||||
return 0
|
||||
fi
|
||||
|
||||
echo '
|
||||
SELECT COUNT(*)
|
||||
FROM tasks
|
||||
WHERE status = 0
|
||||
@ -122,6 +17,7 @@ master() {
|
||||
SELECT
|
||||
id,
|
||||
source_file,
|
||||
required,
|
||||
cmd_arg0,
|
||||
cmd_arg1,
|
||||
cmd_arg2,
|
||||
@ -191,12 +87,15 @@ master() {
|
||||
ORDER BY source_file
|
||||
LIMIT 1;
|
||||
' >&3
|
||||
|
||||
read -u4 remaining
|
||||
read -u4 ready
|
||||
|
||||
if (( active == 0 && ready == 0 ))
|
||||
if (( remaining == 0 ))
|
||||
then
|
||||
dumpfile="$tempdir/tasks-$(date -Iseconds).csv"
|
||||
sleep 0.1
|
||||
return 0
|
||||
elif (( active == 0 && ready == 0 ))
|
||||
then
|
||||
dumpfile=tasks-$(date +%Y%m%d%H%M%S).csv
|
||||
cat <<-EOF
|
||||
|
||||
|
||||
@ -212,7 +111,6 @@ master() {
|
||||
.mode list
|
||||
.headers off
|
||||
.output stdout
|
||||
COMMIT;
|
||||
EOSQL
|
||||
closeDatabase
|
||||
echo "Waiting for children to come back home..."
|
||||
@ -223,7 +121,148 @@ master() {
|
||||
then
|
||||
sleep 0.1
|
||||
else
|
||||
createworker
|
||||
(( ++active ))
|
||||
read -u4 line
|
||||
taskid=${line%%::AtOM:SQL:Sep::*}
|
||||
rest="${line#*::AtOM:SQL:Sep::}::AtOM:SQL:Sep::"
|
||||
sourcefileid=${rest%%::AtOM:SQL:Sep::*}
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
required=${rest%%::AtOM:SQL:Sep::*}
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cmd_arg+=("${rest%%::AtOM:SQL:Sep::*}")
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
cleanup=${rest%%::AtOM:SQL:Sep::*}
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
destfileid=${rest%%::AtOM:SQL:Sep::*}
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
destfilename=${rest%%::AtOM:SQL:Sep::*}
|
||||
rest=${rest#*::AtOM:SQL:Sep::}
|
||||
for key in ${!cmd_arg[@]}
|
||||
do
|
||||
[ -z "${cmd_arg[key]}" ] && unset cmd_arg[key]
|
||||
done
|
||||
workerid=$(getworkerid)
|
||||
workertasks[workerid]=$taskid
|
||||
Update tasks status 1 <<<"id = $taskid"
|
||||
createworker $workerid
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user