20-12-2022
This commit is contained in:
@@ -29,11 +29,12 @@ Namespace Scheduler.Jobs
|
||||
Database = oJobData.Item(Constants.Scheduler.JOB_CONFIG_DATABASE)
|
||||
State = oJobData.Item(Constants.Scheduler.JOB_CONFIG_STATE)
|
||||
Windream = oJobData.Item(Constants.Scheduler.JOB_CONFIG_WINDREAM)
|
||||
Logger = LogConfig.GetLogger()
|
||||
|
||||
ExecutionId = Guid.NewGuid.ToString()
|
||||
Id = Integer.Parse(oArgs.Item("Id"))
|
||||
Name = oArgs.Item("Name")
|
||||
Logger = LogConfig.GetLogger(Name)
|
||||
|
||||
State.JobStatus.Start(ctx)
|
||||
|
||||
Logger.Info("Job [{0}] is starting!", Id)
|
||||
@@ -83,6 +84,11 @@ Namespace Scheduler.Jobs
|
||||
Return Task.FromResult(True)
|
||||
End Function
|
||||
|
||||
Public Function CompleteJobWithWaiting(pMessage As String) As Task(Of Boolean)
|
||||
ctx.Result = State.JobStatus.CompleteWithWaiting(ctx, JobSteps, pMessage)
|
||||
Return Task.FromResult(True)
|
||||
End Function
|
||||
|
||||
|
||||
Public Function CompleteJobWithError(pException As Exception) As Task(Of Boolean)
|
||||
ctx.Result = State.JobStatus.CompleteWithError(ctx, JobSteps, pException)
|
||||
|
||||
@@ -29,7 +29,7 @@ Namespace Scheduler.Jobs
|
||||
|
||||
If IO.Directory.Exists(oProfile.SourceFolder) = False Then
|
||||
LogError("Source directory [{0}] does not exist!", oProfile.SourceFolder)
|
||||
Return Task.FromResult(False)
|
||||
Return CompleteJobWithError(New IO.DirectoryNotFoundException($"Source directory [{oProfile.SourceFolder}] does not exist!"))
|
||||
End If
|
||||
|
||||
Dim oRecursive As Boolean = oProfile.IncludeSubfolders
|
||||
@@ -40,24 +40,24 @@ Namespace Scheduler.Jobs
|
||||
|
||||
If oFileNames.Count = 0 Then
|
||||
Logger.Info("No Files for Profile [{0}]", Name)
|
||||
Return CompleteJob("No files for profile")
|
||||
Return CompleteJobWithWaiting("No files for profile")
|
||||
End If
|
||||
|
||||
LogInfo("{0} files found in source directory {1}", oFileNames.Count, oProfile.SourceFolder)
|
||||
LogInfo("{0} files found in source directory {1}", oFileNames.Count.ToString, oProfile.SourceFolder)
|
||||
|
||||
' - [ ] Process Rules, build list of files and indexes
|
||||
' - [x] Process Regex to filter out files
|
||||
' - [x] Check time to filter out files
|
||||
' - [ ] (Check if files can be accessed)
|
||||
' - [ ] Check if backup is needed and backup files
|
||||
' - [ ] Import into windream
|
||||
' - [x] Import into windream
|
||||
' - [ ] Create original subfolder structure
|
||||
' - [ ] Create DateTime Subfolders
|
||||
' - [x] Check if file exists and version
|
||||
' - [x] Do import
|
||||
' - [ ] Check for filesize 0
|
||||
' - [ ] Write indexes (using data from getimportfile)
|
||||
' - [ ] Check if orig file should be deleted
|
||||
' - [x] Write indexes (using data from getimportfile)
|
||||
' - [x] Check if orig file should be deleted
|
||||
' - [ ] (delete subdirectories in source path)
|
||||
|
||||
Dim oFiles = oFileNames.
|
||||
@@ -71,12 +71,22 @@ Namespace Scheduler.Jobs
|
||||
LogDebug("{0} Files filtered out for being too new.", oDateFilteredCount)
|
||||
oFilteredFiles = oDateFilteredFiles
|
||||
|
||||
If oFilteredFiles.Count = 0 Then
|
||||
Logger.Info("No Files for Profile [{0}]", Name)
|
||||
Return CompleteJobWithWaiting("No files for profile")
|
||||
End If
|
||||
|
||||
' Process Regex to filter out files
|
||||
Dim oRegexFilteredFiles = oFilteredFiles.Where(Function(f) Not FileMatchesRegex(f, oRegexList))
|
||||
Dim oRegexFilteredCount = oFilteredFiles.Except(oRegexFilteredFiles).Count()
|
||||
LogDebug("{0} Files filtered out for matching exclusion Regex.", oRegexFilteredCount)
|
||||
oFilteredFiles = oDateFilteredFiles
|
||||
|
||||
If oFilteredFiles.Count = 0 Then
|
||||
Logger.Info("No Files for Profile [{0}]", Name)
|
||||
Return CompleteJobWithWaiting("No files for profile")
|
||||
End If
|
||||
|
||||
'-------------------------------------------------------------------------------------------------
|
||||
' After this point, files are treated as processed and are being deleted before finishing the job
|
||||
'-------------------------------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user