-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into 'master'
Adding support for local computing (HPC cluster simulation) See merge request ADAS-Private/HEAppE/heappe-core!71
- Loading branch information
Showing
243 changed files
with
12,415 additions
and
8,093 deletions.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
BackgroundThread/Configuration/BackGroundThreadConfiguration.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
namespace HEAppE.BackgroundThread.Configuration | ||
{ | ||
/// <summary> | ||
/// Background Thread configuration | ||
/// </summary> | ||
public sealed class BackGroundThreadConfiguration | ||
{ | ||
/// <summary> | ||
/// Get all jobs information check in seconds | ||
/// </summary> | ||
public static int GetAllJobsInformationCheck { get; set; } = 30; | ||
|
||
/// <summary> | ||
/// Close connection to finished jobs check in seconds | ||
/// </summary> | ||
public static int CloseConnectionToFinishedJobsCheck { get; set; } = 30; | ||
|
||
/// <summary> | ||
/// Cluster account rotation job check in seconds | ||
/// </summary> | ||
public static int ClusterAccountRotationJobCheck { get; set; } = 30; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,39 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using HEAppE.BackgroundThread.Configuration; | ||
using HEAppE.BackgroundThread.Tasks; | ||
using HEAppE.BusinessLogicTier.Configuration; | ||
|
||
namespace HEAppE.BackgroundThread { | ||
public class MiddlewareBackgroundTaskRunner { | ||
private readonly List<IBackgroundTask> tasks; | ||
|
||
public MiddlewareBackgroundTaskRunner() { | ||
tasks = new List<IBackgroundTask>(); | ||
tasks.Add(new GetAllJobsInfo(new TimeSpan(0, 0, 30))); | ||
//tasks.Add(new SynchronizeJobFileContents(new TimeSpan(0, 0, 30))); | ||
tasks.Add(new CloseConnectionToFinishedJobs(new TimeSpan(0, 0, 30))); | ||
tasks.Add(new ClusterAccountRotationJob(new TimeSpan(0, 0, 30))); | ||
} | ||
using System; | ||
using System.Collections.Generic; | ||
|
||
public void Start() { | ||
foreach (var task in tasks) { | ||
task.StartTimer(); | ||
} | ||
} | ||
namespace HEAppE.BackgroundThread | ||
{ | ||
public class MiddlewareBackgroundTaskRunner | ||
{ | ||
#region Instances | ||
private readonly List<IBackgroundTask> _tasks = new(); | ||
#endregion | ||
#region Constructors | ||
public MiddlewareBackgroundTaskRunner() | ||
{ | ||
_tasks.Add(new GetAllJobsInfo(TimeSpan.FromSeconds(BackGroundThreadConfiguration.GetAllJobsInformationCheck))); | ||
_tasks.Add(new CloseConnectionToFinishedJobs(TimeSpan.FromSeconds(BackGroundThreadConfiguration.CloseConnectionToFinishedJobsCheck))); | ||
_tasks.Add(new ClusterAccountRotationJob(TimeSpan.FromSeconds(BackGroundThreadConfiguration.ClusterAccountRotationJobCheck))); | ||
} | ||
#endregion | ||
#region Methods | ||
public void Start() | ||
{ | ||
foreach (var task in _tasks) | ||
{ | ||
task.StartTimer(); | ||
} | ||
} | ||
|
||
public void Stop() { | ||
foreach (var task in tasks) { | ||
task.StopTimer(); | ||
} | ||
} | ||
} | ||
public void Stop() | ||
{ | ||
foreach (var task in _tasks) | ||
{ | ||
task.StopTimer(); | ||
} | ||
} | ||
#endregion | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,30 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using HEAppE.BusinessLogicTier.Factory; | ||
using HEAppE.BusinessLogicTier.Factory; | ||
using HEAppE.DataAccessTier.UnitOfWork; | ||
using HEAppE.DomainObjects.JobManagement.JobInformation; | ||
using HEAppE.ServiceTier.JobManagement; | ||
using HEAppE.ServiceTier.DataTransfer; | ||
using HEAppE.BusinessLogicTier.Logic.DataTransfer; | ||
using System; | ||
using System.Linq; | ||
|
||
namespace HEAppE.BackgroundThread.Tasks { | ||
/// <summary> | ||
/// Close all open sockets to finished/failed/canceled jobs | ||
/// </summary> | ||
internal class CloseConnectionToFinishedJobs : AbstractTask, IBackgroundTask { | ||
public CloseConnectionToFinishedJobs(TimeSpan interval) : base(interval) { } | ||
namespace HEAppE.BackgroundThread.Tasks | ||
{ | ||
/// <summary> | ||
/// Close all open sockets to finished/failed/canceled jobs | ||
/// </summary> | ||
internal class CloseConnectionToFinishedJobs : AbstractTask, IBackgroundTask | ||
{ | ||
public CloseConnectionToFinishedJobs(TimeSpan interval) : base(interval) | ||
{ | ||
|
||
protected override void RunTask() { | ||
using (IUnitOfWork unitOfWork = new DatabaseUnitOfWork()) { | ||
List<long> jobIds = LogicFactory.GetLogicFactory().CreateDataTransferLogic(unitOfWork).GetJobIdsForOpenTunnels(); | ||
foreach (long jobId in jobIds) | ||
{ | ||
//check the job's status | ||
SubmittedJobInfo jobInfo = unitOfWork.SubmittedJobInfoRepository.GetById(jobId); | ||
if (jobInfo.State >= JobState.Finished && jobInfo.State != JobState.WaitingForServiceAccount) | ||
{ | ||
LogicFactory.GetLogicFactory().CreateDataTransferLogic(unitOfWork).CloseAllConnectionsForJob(jobInfo); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
} | ||
protected override void RunTask() | ||
{ | ||
using IUnitOfWork unitOfWork = new DatabaseUnitOfWork(); | ||
var dataTransferLogic = LogicFactory.GetLogicFactory().CreateDataTransferLogic(unitOfWork); | ||
|
||
var taskIds = dataTransferLogic.GetTaskIdsWithOpenTunnels(); | ||
LogicFactory.GetLogicFactory().CreateJobManagementLogic(unitOfWork).GetAllFinishedTaskInfos(taskIds) | ||
.ToList() | ||
.ForEach(f => dataTransferLogic.CloseAllTunnelsForTask(f)); | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,23 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using HEAppE.BusinessLogicTier.Factory; | ||
using HEAppE.BusinessLogicTier.Factory; | ||
using HEAppE.DataAccessTier.UnitOfWork; | ||
using HEAppE.DomainObjects.JobManagement.JobInformation; | ||
using HEAppE.ServiceTier.JobManagement; | ||
using System; | ||
|
||
namespace HEAppE.BackgroundThread.Tasks { | ||
/// <summary> | ||
/// Get all unfinished jobs from db and load their status from cluster | ||
/// and updates their status in DB | ||
/// </summary> | ||
internal class GetAllJobsInfo : AbstractTask, IBackgroundTask { | ||
public GetAllJobsInfo(TimeSpan interval) : base(interval) {} | ||
namespace HEAppE.BackgroundThread.Tasks | ||
{ | ||
/// <summary> | ||
/// Get all unfinished jobs from db and load their status from cluster | ||
/// and updates their status in DB | ||
/// </summary> | ||
internal class GetAllJobsInfo : AbstractTask, IBackgroundTask | ||
{ | ||
public GetAllJobsInfo(TimeSpan interval) : base(interval) | ||
{ | ||
} | ||
|
||
protected override void RunTask() { | ||
using IUnitOfWork unitOfWork = new DatabaseUnitOfWork(); | ||
LogicFactory.GetLogicFactory().CreateJobManagementLogic(unitOfWork).UpdateCurrentStateOfUnfinishedJobs(); | ||
protected override void RunTask() | ||
{ | ||
using IUnitOfWork unitOfWork = new DatabaseUnitOfWork(); | ||
LogicFactory.GetLogicFactory().CreateJobManagementLogic(unitOfWork).UpdateCurrentStateOfUnfinishedJobs(); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.