Organize Piscal Service items
Add nlog, PiscalQueueManager modified: Core.Tests/Remote/PiscalSshClientTests.cs modified: Core/DAL/DataService.cs modified: Core/Remote/IPiscalClient.cs modified: Core/Remote/PiscalSshClient.cs new file: Web/Attributes/ActionLogAttribute.cs modified: Web/Controllers/ControllerBase.cs modified: Web/Controllers/LeafInputController.cs modified: Web/Controllers/LeafOutputController.cs new file: Web/NLog.config new file: Web/NLog.xsd new file: Web/Services/PiscalQueueManager.cs modified: Web/Services/PiscalService.cs modified: Web/Startup.cs modified: Web/Web.csproj modified: Web/packages.config Ignore logs Organize piscal queue manager modified: Core/Entities/LeafInputFile.cs modified: Web/Controllers/LeafInputController.cs renamed: Web/Startup.cs -> Web/HangfireStartup.cs modified: Web/Services/PiscalQueueManager.cs modified: Web/Web.csproj cleanup usings in leafinputcontroller
This commit is contained in:
+21
-9
@@ -56,7 +56,7 @@ namespace LeafWeb.Core.DAL
|
||||
_db.LeafInputs.Add(leafInput);
|
||||
foreach (var leafInputFile in leafInput.Files)
|
||||
{
|
||||
SetLeafInputFileStatusNoUpdate(leafInputFile, LeafInputStatusType.Added);
|
||||
SetLeafInputFileStatusNoUpdate(leafInputFile, LeafInputStatusType.Queued);
|
||||
}
|
||||
_db.SaveChanges();
|
||||
}
|
||||
@@ -104,14 +104,6 @@ namespace LeafWeb.Core.DAL
|
||||
UpdateLeafInputFile(leafInputFile);
|
||||
}
|
||||
|
||||
public LeafInputFile GetNextUnprocessedLeafInputFile()
|
||||
{
|
||||
return
|
||||
(from file in GetLeafInputFiles(LeafInputStatusType.Added)
|
||||
orderby file.Id ascending
|
||||
select file).FirstOrDefault();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Photosynthesis Types
|
||||
@@ -127,5 +119,25 @@ namespace LeafWeb.Core.DAL
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region LeafOutputFile
|
||||
|
||||
public void AddLeafOutputFile(LeafOutputFile leafOutput)
|
||||
{
|
||||
_db.LeafOutputFiles.Add(leafOutput);
|
||||
_db.SaveChanges();
|
||||
}
|
||||
|
||||
public IQueryable<LeafOutputFile> GetLeafOutputFiles()
|
||||
{
|
||||
return _db.LeafOutputFiles;
|
||||
}
|
||||
|
||||
public LeafOutputFile GetLeafOutputFile(int id)
|
||||
{
|
||||
return _db.LeafOutputFiles.Find(id);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,10 @@ namespace LeafWeb.Core.Entities
|
||||
public int Id { get; set; }
|
||||
|
||||
public virtual LeafInput LeafInput { get; set; }
|
||||
public virtual ICollection<LeafOutputFile> LeafOutputFiles { get; set; }
|
||||
|
||||
public LeafInputStatusType CurrentStatus { get; set; }
|
||||
public virtual ICollection<LeafInputFileStatus> StatusHistory { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Parsed values from the LeafInput used in LeafWeb for filtering/searching
|
||||
@@ -17,7 +21,9 @@ namespace LeafWeb.Core.Entities
|
||||
|
||||
public byte[] Contents { get; set; }
|
||||
|
||||
public LeafInputStatusType CurrentStatus { get; set; }
|
||||
public virtual ICollection<LeafInputFileStatus> StatusHistory { get; set; }
|
||||
public override string ToString()
|
||||
{
|
||||
return $"{Id}_{Filename}";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,9 +2,9 @@ namespace LeafWeb.Core.Entities
|
||||
{
|
||||
public enum LeafInputStatusType
|
||||
{
|
||||
Added,
|
||||
ProcessStarted,
|
||||
ProcessCompleted,
|
||||
ProcessError
|
||||
Queued,
|
||||
Running,
|
||||
Complete,
|
||||
Error
|
||||
}
|
||||
}
|
||||
@@ -4,8 +4,8 @@ namespace LeafWeb.Core.Remote
|
||||
{
|
||||
public interface IPiscalClient
|
||||
{
|
||||
void SubmitLeafInputFile(PiscalLeafInputFile file);
|
||||
PiscalStatus GetLeafInputStatus(PiscalLeafInputFile file);
|
||||
void RunLeafInputFile(PiscalLeafInputFile file);
|
||||
PiscalStatus GetLeafInputFileStatus(PiscalLeafInputFile file);
|
||||
IEnumerable<PiscalLeafOutputFile> RetrieveLeafOutput(PiscalLeafInputFile file);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace LeafWeb.Core.Remote
|
||||
return new ScpClient(_connectionInfo);
|
||||
}
|
||||
|
||||
public void SubmitLeafInputFile(PiscalLeafInputFile file)
|
||||
public void RunLeafInputFile(PiscalLeafInputFile file)
|
||||
{
|
||||
var inputPath = $"{BaseDirectory}/{file.DirectoryName}/{file.Filename}";
|
||||
|
||||
@@ -64,7 +64,7 @@ namespace LeafWeb.Core.Remote
|
||||
}
|
||||
}
|
||||
|
||||
public PiscalStatus GetLeafInputStatus(PiscalLeafInputFile file)
|
||||
public PiscalStatus GetLeafInputFileStatus(PiscalLeafInputFile file)
|
||||
{
|
||||
var statusRaw = GetLeafInputStatusRaw(file);
|
||||
|
||||
@@ -99,6 +99,9 @@ namespace LeafWeb.Core.Remote
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the leaf output from piscal, only run on if result status is success
|
||||
/// </summary>
|
||||
public IEnumerable<PiscalLeafOutputFile> RetrieveLeafOutput(PiscalLeafInputFile file)
|
||||
{
|
||||
// get output files
|
||||
|
||||
Reference in New Issue
Block a user