Skip to content
Snippets Groups Projects
Commit ac02eac9 authored by brinn's avatar brinn
Browse files

(merged from Datamover 1.0.x branch, r2163)

fix: manual intervention feature

SVN: 2169
parent fb7087cb
No related branches found
No related tags found
No related merge requests found
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
</appender> </appender>
<appender name="MANUAL_INTERVENTION" class="org.apache.log4j.DailyRollingFileAppender"> <appender name="MANUAL_INTERVENTION_APPENDER" class="org.apache.log4j.DailyRollingFileAppender">
<param name="File" value="log/manual_intervention.txt"/> <param name="File" value="log/manual_intervention.txt"/>
<param name="DatePattern" value="'.'yyyy-MM-dd"/> <param name="DatePattern" value="'.'yyyy-MM-dd"/>
...@@ -58,9 +58,9 @@ ...@@ -58,9 +58,9 @@
<appender-ref ref="EMAIL" /> <appender-ref ref="EMAIL" />
</category> </category>
<logger name="OPERATION.ch.systemsx.cisd.datamover.GatePathHandlerDecorator"> <logger name="MANUAL_INTERVENTION">
<level value ="info" /> <level value ="info" />
<appender-ref ref="MANUAL_INTERVENTION" /> <appender-ref ref="MANUAL_INTERVENTION_APPENDER" />
</logger> </logger>
<root> <root>
......
...@@ -12,7 +12,6 @@ prefix-for-incoming = %t_ ...@@ -12,7 +12,6 @@ prefix-for-incoming = %t_
# Optional (remove comments when changing the values) # Optional (remove comments when changing the values)
# #
# rsync-executable = <path to rsync> # rsync-executable = <path to rsync>
# ssh-executable = <path to ssh>
# hard-link-executable = <path to ln for creating hard links> # hard-link-executable = <path to ln for creating hard links>
# outgoing-host = <host where the outgoing directory is located (specify only when using an ssh tunnel)> # outgoing-host = <host where the outgoing directory is located (specify only when using an ssh tunnel)>
# incoming-host = <host where the incoming directory is located (specify only when using an ssh tunnel)> # incoming-host = <host where the incoming directory is located (specify only when using an ssh tunnel)>
...@@ -23,7 +22,7 @@ prefix-for-incoming = %t_ ...@@ -23,7 +22,7 @@ prefix-for-incoming = %t_
# failure-interval = <time interval to wait after a failure before the operation is re-tried in seconds> # failure-interval = <time interval to wait after a failure before the operation is re-tried in seconds>
# max-retries = <maximal number of retries when an operation fails> # max-retries = <maximal number of retries when an operation fails>
# cleansing-regex = <regex of paths that should be removed before moving a path to outgoing> # cleansing-regex = <regex of paths that should be removed before moving a path to outgoing>
# manual-intervention-regex = <regex of paths that need manual intervention> # manual-intervention-regex = <regex of paths that need manual intervention, default prefix-for-incoming corresponds to '[0-9]{14}_'>
# treat-incoming-as-remote = <true or false, when switched on, than incoming directory is treated as remote> # treat-incoming-as-remote = <true or false, when switched on, than incoming directory is treated as remote>
# extra-copy-dir = <path to a directory. If specified, a copy of incoming data will be made there> # extra-copy-dir = <path to a directory. If specified, a copy of incoming data will be made there>
# prefix-for-incoming = prefix that is put in front of every incoming data directory, %t will be replaced with time stamp # prefix-for-incoming = prefix that is put in front of every incoming data directory, %t will be replaced with time stamp
\ No newline at end of file
...@@ -46,6 +46,8 @@ public class LocalProcessor implements IPathHandler, IRecoverableTimerTaskFactor ...@@ -46,6 +46,8 @@ public class LocalProcessor implements IPathHandler, IRecoverableTimerTaskFactor
{ {
private static final Logger operationLog = LogFactory.getLogger(LogCategory.OPERATION, LocalProcessor.class); private static final Logger operationLog = LogFactory.getLogger(LogCategory.OPERATION, LocalProcessor.class);
private static final Logger manualInterventionLog = Logger.getLogger("MANUAL_INTERVENTION");
private static final ISimpleLogger errorLog = new Log4jSimpleLogger(Level.ERROR, operationLog); private static final ISimpleLogger errorLog = new Log4jSimpleLogger(Level.ERROR, operationLog);
private static final Logger notificationLog = LogFactory.getLogger(LogCategory.NOTIFY, LocalProcessor.class); private static final Logger notificationLog = LogFactory.getLogger(LogCategory.NOTIFY, LocalProcessor.class);
...@@ -260,8 +262,9 @@ public class LocalProcessor implements IPathHandler, IRecoverableTimerTaskFactor ...@@ -260,8 +262,9 @@ public class LocalProcessor implements IPathHandler, IRecoverableTimerTaskFactor
manualInterventionFilter.add(PathType.ALL, manualInterventionRegex); manualInterventionFilter.add(PathType.ALL, manualInterventionRegex);
} }
final boolean filtered = manualInterventionFilter.accept(resource); final boolean needsManualIntervention = manualInterventionFilter.accept(resource);
if (filtered) logManualIntervention(resource, needsManualIntervention);
if (needsManualIntervention)
{ {
log(resource, "Moving to manual intervention directory"); log(resource, "Moving to manual intervention directory");
File movedFile = mover.tryMove(resource, manualInterventionDir); File movedFile = mover.tryMove(resource, manualInterventionDir);
...@@ -279,4 +282,14 @@ public class LocalProcessor implements IPathHandler, IRecoverableTimerTaskFactor ...@@ -279,4 +282,14 @@ public class LocalProcessor implements IPathHandler, IRecoverableTimerTaskFactor
operationLog.info(String.format("%s on %s", description, path.getPath())); operationLog.info(String.format("%s on %s", description, path.getPath()));
} }
} }
private static void logManualIntervention(File path, boolean needsManualIntervention)
{
if (manualInterventionLog.isInfoEnabled())
{
manualInterventionLog.info(String.format("%s %s [created: %3$tY-%3$tm-%3$td %3$tH:%3$tM:%3$tS]",
needsManualIntervention ? "ATTENTION" : "DEFAULT", path.getAbsolutePath(), path.lastModified()));
}
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment