Commit 4916de07 authored by Alexandre Boyer's avatar Alexandre Boyer
Browse files

add clear-logs command

parent 3fbc2355
Pipeline #130711 passed with stage
in 27 seconds
......@@ -23,13 +23,15 @@ from diva_evaluation_cli.bin.commands.actev_merge_chunks import ActevMergeChunks
from diva_evaluation_cli.bin.commands.actev_exec import ActevExec
from diva_evaluation_cli.bin.commands.actev_status import ActevStatus
from diva_evaluation_cli.bin.commands.actev_validate_execution import ActevValidateExecution
from diva_evaluation_cli.bin.commands.actev_clear_logs import ActevClearLogs
private_subcommands = [
ActevGetSystem(),
ActevValidateSystem(),
ActevExec(),
ActevStatus(),
ActevValidateExecution()
ActevValidateExecution(),
ActevClearLogs()
]
public_subcommands = [
......
"""Actev module: system-setup
Actev modules are used to parse actev commands in order to get arguments
before calling associated entry point methods to execute systems.
Warning: this file should not be modified: see src/entry_points to add your source code.
"""
import logging
from diva_evaluation_cli.bin.commands.actev_command import ActevCommand
from diva_evaluation_cli.bin.private_src.entry_points.actev_clear_logs import entry_point
class ActevClearLogs(ActevCommand):
"""Delete temporary files as resource and status monitoring files.
"""
def __init__(self):
super(ActevClearLogs, self).__init__('clear-logs', entry_point)
def cli_parser(self, arg_parser):
"""Configure the description and the arguments (positional and optional) to parse.
Args:
arg_parser(:obj:`ArgParser`): Python arg parser to describe how to parse the command
"""
arg_parser.description = "Delete temporary files as resource and status monitoring files"
arg_parser.set_defaults(func=ActevClearLogs.command, object=self)
"""Entry point module: exec
This file should not be modified.
"""
import os
def entry_point():
"""Private entry point.
Delete temporary files as resource and status monitoring files.
"""
# go into the right directory to execute the script
path = os.path.dirname(__file__)
script = os.path.join(path, '../implementation/clear_logs/clear_logs.sh')
# execute the script
# status is the exit status code returned by the program
status = os.system(script)
if status != 0:
raise Exception("Error occured in clear_logs.sh")
#!/bin/bash
CURRENT_DIR=$(dirname $0)/../..
for LOG in `find $CURRENT_DIR -type f | grep "_monitoring.json"`; do
rm $LOG
echo "$LOG deleted"
done
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment