time estimation
This commit is contained in:
parent
2c868c4131
commit
d3daff9593
51
atom
51
atom
@ -1034,7 +1034,7 @@ copyFile() {
|
||||
extension="${filename##*.}"
|
||||
commandline="cp -al \"$sourcepath/$filename\" \"$destdir/$destfile.$extension\""
|
||||
commandline+=" 2>/dev/null"
|
||||
commandline+=' || '
|
||||
commandline+=' AtOM:OR '
|
||||
commandline+="cp -a \"$sourcepath/$filename\" \"$destdir/$destfile\""
|
||||
copytaskid=$(
|
||||
Insert tasks <<-EOInsert
|
||||
@ -1231,7 +1231,7 @@ worker() {
|
||||
rest=${rest#*|}
|
||||
destfilename=${rest%%|*}
|
||||
rest=${rest#*|}
|
||||
if eval $commandline >/dev/null 2>>"$tempdir/errors.log"
|
||||
if eval ${commandline/AtOM:OR/||} >/dev/null 2>>"$tempdir/errors.log"
|
||||
then
|
||||
echo "finished $taskid|$sourcefileid|$destfileid|$destfilename"
|
||||
else
|
||||
@ -1269,7 +1269,6 @@ master() {
|
||||
then
|
||||
eval echo AtOM:Die '>&'$((100+workerid))
|
||||
wait ${workers[workerid]}
|
||||
break
|
||||
eval $((100+workerid))'>&-'
|
||||
eval $((200+workerid))'<&-'
|
||||
rm "$tempdir"/worker${workerid}{in,out}
|
||||
@ -1330,7 +1329,7 @@ master() {
|
||||
unset workers[workerid]
|
||||
fi
|
||||
;;
|
||||
'finished')
|
||||
?(f)'inished')
|
||||
(( active-- )) || true
|
||||
taskid=${workerquery%%|*}
|
||||
rest="${workerquery#*|}|"
|
||||
@ -1344,7 +1343,7 @@ master() {
|
||||
then
|
||||
echo \
|
||||
"UPDATE destination_files" \
|
||||
"SET filename=\"$destfilename\"," \
|
||||
"SET filename=\"${destfilename//\"/\"\"}\"," \
|
||||
" last_change=(" \
|
||||
" SELECT last_change" \
|
||||
" FROM source_files" \
|
||||
@ -1405,7 +1404,7 @@ then
|
||||
fi
|
||||
getConfig
|
||||
|
||||
set -e
|
||||
set -eH
|
||||
if (( debug ))
|
||||
then
|
||||
cat <<-EOF
|
||||
@ -1768,6 +1767,7 @@ echo -e "\rCreated ${count:-0} tasks for $filecount files"
|
||||
|
||||
rm -f "$tempdir"/worker*
|
||||
concurrency=$(( maxload / 2 ))
|
||||
(( concurrency )) || concurrency=1
|
||||
active=0
|
||||
for (( i=0 ; i < concurrency ; i++ ))
|
||||
do
|
||||
@ -1822,34 +1822,61 @@ do
|
||||
fi
|
||||
fi
|
||||
master
|
||||
if ((taskcount - remaining))
|
||||
then
|
||||
currenttime=$(date +%s)
|
||||
secsremaining=$((
|
||||
remaining
|
||||
*
|
||||
(currenttime - starttime)
|
||||
/
|
||||
(taskcount - remaining)
|
||||
))
|
||||
(( days =
|
||||
secsremaining
|
||||
/
|
||||
( 24*60*60 )
|
||||
)) || true
|
||||
(( hours =
|
||||
( secsremaining - ( days*24*60*60 ) )
|
||||
/
|
||||
( 60*60 )
|
||||
)) || true
|
||||
(( minutes =
|
||||
( secsremaining - ( ( days*24 + hours ) *60*60 ) )
|
||||
/
|
||||
60
|
||||
)) || true
|
||||
fi
|
||||
echo -en "\rload: $humanload / $maxload" \
|
||||
"workers: $active / $concurrency" \
|
||||
"done: $(( (taskcount - remaining ) * 100 / taskcount ))%" \
|
||||
" $((taskcount - remaining)) of $taskcount ($failed failed)"
|
||||
"- $((taskcount - remaining)) of $taskcount ($failed failed)" \
|
||||
"${days}d ${hours}h${minutes}m "
|
||||
done
|
||||
|
||||
endtime=$(date +%s)
|
||||
|
||||
(( elapsedseconds = endtime - starttime ))
|
||||
(( days =
|
||||
elapsedseconds
|
||||
secsremaining
|
||||
/
|
||||
( 24*60*60 )
|
||||
)) || true
|
||||
(( hours =
|
||||
( elapsedseconds - ( days*24*60*60 ) )
|
||||
( secsremaining - ( days*24*60*60 ) )
|
||||
/
|
||||
( 60*60 )
|
||||
)) || true
|
||||
(( minutes =
|
||||
( elapsedseconds - ( ( days*24*60*60 ) + ( hours*60*60 ) ) )
|
||||
( secsremaining - ( ( days*24 + hours ) *60*60 ) )
|
||||
/
|
||||
60
|
||||
)) || true
|
||||
(( seconds =
|
||||
elapsedseconds
|
||||
secsremaining
|
||||
-
|
||||
( ( days*24*60*60 ) + ( hours*60*60 ) + ( minutes*60) )
|
||||
( ( ( ( days*24 + hours ) *60 ) + minutes ) *60 )
|
||||
)) || true
|
||||
|
||||
echo -e "\rRan $taskcount tasks, $failed of which failed, in $days" \
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user