16-12-2022

This commit is contained in:
Jonathan Jenne
2022-12-16 15:59:26 +01:00
parent 63edd9e542
commit 45f8dd2aad
32 changed files with 431 additions and 276 deletions

View File

@@ -13,6 +13,7 @@ Namespace Scheduler.Jobs
Friend State As State
Friend Id As Integer
Friend ExecutionId As String
Friend Name As String
Friend ResultItems As New List(Of HistoryItem.HistoryStep)
@@ -30,6 +31,7 @@ Namespace Scheduler.Jobs
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")

View File

@@ -39,15 +39,26 @@ Public Class State
LoadData()
End Sub
Private Sub LoadData()
Public Sub ReloadTypes()
_JobTypes = GetJobTypes()
_ObjectTypes = GetObjectTypes()
End Sub
Public Sub ReloadJobs()
_JobDefinitions = GetJobDefinitions(_JobTypes)
End Sub
Public Sub ReloadProfiles()
_ProfileDefintions.ImportProfileSteps = GetImportProfileSteps()
_ProfileDefintions.ImportProfiles = GetImportProfiles()
End Sub
Private Sub LoadData()
ReloadTypes()
ReloadJobs()
ReloadProfiles()
End Sub
Private Function GetObjectTypes() As List(Of ObjectType)
Dim oObjectTypes As New List(Of ObjectType)
Try

View File

@@ -16,6 +16,8 @@ Namespace WCF
Public Shared Database As MSSQLServer
Public Shared Scheduler As JobScheduler
Private ReadOnly Logger As Logger
''' <summary>
''' See: https://stackoverflow.com/questions/42327988/addserviceendpoint-throws-key-is-null
''' </summary>
@@ -33,33 +35,41 @@ Namespace WCF
})
End Sub
Public Sub New()
Logger = LogConfig.GetLogger()
End Sub
Public Function GetHeartbeat() As Date Implements IJobRunner.GetHeartbeat
Return Now
End Function
Public Function GetJobHistory() As GetJobStatus.GetJobStatusResponse Implements IJobRunner.GetJobStatus
Logger.Info("Calling Method [GetJobHistory]")
Dim oMethod As New GetJobStatus.GetJobStatusMethod(LogConfig, Database, State, Scheduler)
Return oMethod.Run()
End Function
Public Function GetJobConfig() As GetJobConfig.GetJobConfigResponse Implements IJobRunner.GetJobConfig
Logger.Info("Calling Method [GetJobConfig]")
Dim oMethod As New GetJobConfig.GetJobConfigMethod(LogConfig, Database, State)
Return oMethod.Run()
End Function
Public Function UpdateJob(pData As UpdateJob.UpdateJobRequest) As UpdateJob.UpdateJobResponse Implements IJobRunner.UpdateJob
Logger.Info("Calling Method [UpdateJob]")
Dim oMethod As New UpdateJob.UpdateJobMethod(LogConfig, Database, State, Scheduler)
Return oMethod.Run(pData)
End Function
Public Function UpdateProfile(pData As UpdateProfile.UpdateProfileRequest) As UpdateProfile.UpdateProfileResponse Implements IJobRunner.UpdateProfile
Logger.Info("Calling Method [UpdateProfile]")
Dim oMethod As New UpdateProfile.UpdateProfileMethod(LogConfig, Database, State, Scheduler)
Return oMethod.Run(pData)
End Function
Public Function RunJob(pData As RunJob.RunJobRequest) As RunJob.RunJobResponse Implements IJobRunner.RunJob
'Dim oMethod As New RunJob.RunJobMethod(LogConfig, Database, State, Scheduler)
'Return oMethod.Run(pData)
Dim oMethod As New RunJob.RunJobMethod(LogConfig, Database, State, Scheduler)
Return oMethod.Run(pData)
End Function
End Class

View File

@@ -14,10 +14,10 @@ Public Class RunJob
Scheduler = pScheduler
End Sub
Public Async Function Run(pData As RunJobRequest) As Task(Of RunJobResponse)
Public Function Run(pData As RunJobRequest) As RunJobResponse
' This is calling the async function ScheduleJob synchronous, so that we can return a value to the caller
' This means that the job might or might not be scheduled when this method returns.
Task.Run(Function() Scheduler.ScheduleJob(pData.JobId))
Scheduler.ScheduleJob(pData.JobId)
Return New RunJobResponse()
End Function