Skip to content

Commit

Permalink
#3: Mechanism to control the crunchers.
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolas-slusarenko committed Aug 17, 2018
1 parent e737ef9 commit a7aabc2
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 15 deletions.
4 changes: 2 additions & 2 deletions src/cruncher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Trokam::Cruncher::Cruncher(const Trokam::Options &value): settings(value),

if (settings.cruncherType() == PAGE_CRUNCHER)
{
PERIOD_SIZE = 60 * 60 * 12;
PERIOD_SIZE = 60 * 60 * 24 * 10;
std::cout << "this is a *** PAGE *** cruncher.\n";
}
else if (settings.cruncherType() == DOMAIN_CRUNCHER)
Expand Down Expand Up @@ -170,7 +170,7 @@ void Trokam::Cruncher::process()
level++;
if (level > 5)
{
exit(0);
exit(1);
}
}
}
Expand Down
35 changes: 22 additions & 13 deletions src/pageCruncher
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,27 @@
# along with Trokam. If not, see <http://www.gnu.org/licenses/>.
########################################################################

killall -q cruncher
ZERO=0
while [ $ZERO -eq 0 ]
do
CRUNCHER_LOG=$HOME'/trokam/log/cruncher_'$(date +%Y_%m_%d_%H_%M)'.log'
START=$(date +%s.%N)
./bin/cruncher --pages-limit 1000 > $CRUNCHER_LOG 2>&1
state=$?
END=$(date +%s.%N)
DIFF=$(echo "$END - $START" | bc)
echo "Time elapsed= " $DIFF >> $CRUNCHER_LOG

CRUNCHER_LOG=$HOME'/trokam/log/cruncher_'$(date +%Y_%m_%d_%H_%M)'.log'
START=$(date +%s.%N)
./bin/cruncher > $CRUNCHER_LOG 2>&1
END=$(date +%s.%N)
DIFF=$(echo "$END - $START" | bc)
echo "Time elapsed= " $DIFF >> $CRUNCHER_LOG
FEEDER_LOG=$HOME'/trokam/log/feeder_'$(date +%Y_%m_%d_%H_%M)'.log'
START=$(date +%s.%N)
./bin/feeder > $FEEDER_LOG 2>&1
END=$(date +%s.%N)
DIFF=$(echo "$END - $START" | bc)
echo "Time elapsed= " $DIFF >> $FEEDER_LOG

FEEDER_LOG=$HOME'/trokam/log/feeder_'$(date +%Y_%m_%d_%H_%M)'.log'
START=$(date +%s.%N)
./bin/feeder > $FEEDER_LOG 2>&1
END=$(date +%s.%N)
DIFF=$(echo "$END - $START" | bc)
echo "Time elapsed= " $DIFF >> $FEEDER_LOG
if [ $state -gt 0 ]
then
echo "script is terminated" >> $CRUNCHER_LOG
exit 1
fi
done

0 comments on commit a7aabc2

Please sign in to comment.