Leaf Input and Submit

This commit is contained in:
2016-12-06 11:53:30 -05:00
parent a3b8b7a881
commit 6fd7e46f5d
74 changed files with 56144 additions and 1291 deletions
+4 -4
View File
@@ -54,14 +54,14 @@
<HintPath>..\packages\fasterflect.2.1.3\lib\net40\Fasterflect.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\WebCms\bin\log4net.dll</HintPath>
</Reference>
<Reference Include="MlkPwgen, Version=0.2.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MlkPwgen.0.2.0.0\lib\net45\MlkPwgen.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
<HintPath>..\packages\NLog.4.3.3\lib\net45\NLog.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Renci.SshNet, Version=2013.4.7.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\SSH.NET.2013.4.7\lib\net40\Renci.SshNet.dll</HintPath>
<Private>True</Private>
+2 -2
View File
@@ -1,8 +1,8 @@
using System.Data.Entity;
using System.Data.Entity.ModelConfiguration.Conventions;
using System.Data.Entity.SqlServer;
using log4net;
using LeafWeb.Core.Entities;
using NLog;
namespace LeafWeb.Core.DAL
{
@@ -22,7 +22,7 @@ namespace LeafWeb.Core.DAL
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
LogManager.GetCurrentClassLogger().Debug("OnModelCreating");
LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType).Debug("OnModelCreating");
modelBuilder.Conventions.Remove<PluralizingTableNameConvention>();
base.OnModelCreating(modelBuilder);
+2 -2
View File
@@ -1,9 +1,9 @@
using System.Data.Entity;
using System.Linq;
using log4net;
using LeafWeb.Core.Entities;
using LeafWeb.Core.Parsers;
using LeafWeb.Core.Utility;
using NLog;
namespace LeafWeb.Core.DAL
{
@@ -13,7 +13,7 @@ namespace LeafWeb.Core.DAL
protected override void Seed(LeafWebContext context)
{
LogManager.GetCurrentClassLogger().Debug("Seed");
LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType).Debug("Seed");
// get fluxnet sites from file
var fileInfo = FileUtility.GetContentFile(ContentDirectory, "fluxnet_site_list_all_October2015_with_joins_corrected.csv", true);
+12 -4
View File
@@ -2,8 +2,8 @@ using System.Collections.Generic;
using System.Data.Common;
using System.IO;
using System.Linq;
using log4net;
using LeafWeb.Core.Utility;
using NLog;
using Renci.SshNet;
namespace LeafWeb.Core.Remote
@@ -18,7 +18,7 @@ namespace LeafWeb.Core.Remote
private const string StatusRunning = "running";
private const string StatusNotStarted = "not started";
private readonly Logger _logger = LogManager.GetCurrentClassLogger();
private readonly ILog _logger = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
public PiscalSshClient(string connectionString)
{
@@ -49,7 +49,7 @@ namespace LeafWeb.Core.Remote
var inputPath = $"{directory}/input/{file.Filename}";
using (var stream = new MemoryStream(file.Contents))
{
_logger.Trace("Copying " + inputPath);
_logger.Debug("Copying " + inputPath);
scp.Connect();
scp.Upload(stream, inputPath);
scp.Disconnect();
@@ -59,6 +59,9 @@ namespace LeafWeb.Core.Remote
public void RunLeafInput(PiscalLeafInput leafInput)
{
if (string.IsNullOrEmpty(leafInput.PhotosyntheticType))
throw new PiscalClientException(leafInput.LeafInputId, "No PhotosyntheticType set");
var inputDirectory = $"{BaseDirectory}/{leafInput.PiscalDirectoryName}";
CopyLeafInput(leafInput, inputDirectory);
@@ -82,7 +85,11 @@ namespace LeafWeb.Core.Remote
if (command.ExitStatus != 0)
throw new PiscalClientException(leafInput.LeafInputId, command.Error.TrimEndNewLine());
_logger.Debug("RunLeafInput result: " + command.Result.TrimEndNewLine());
var result = command.Result.TrimEndNewLine();
if (result == "started")
_logger.Info($"RunLeafInput result: {result}");
else
_logger.Warn($"RunLeafInput result: {result}, commandText: {commandText}");
}
}
@@ -101,6 +108,7 @@ namespace LeafWeb.Core.Remote
default:
throw new PiscalClientException(leafInput.LeafInputId, "Unknown status: " + statusRaw[0]);
}
}
private string[] GetLeafInputStatusRaw(PiscalLeafInput leafInput)
-1
View File
@@ -5,6 +5,5 @@
<package id="EntityFramework" version="6.1.3" targetFramework="net45" />
<package id="fasterflect" version="2.1.3" targetFramework="net45" />
<package id="MlkPwgen" version="0.2.0.0" targetFramework="net45" />
<package id="NLog" version="4.3.3" targetFramework="net45" />
<package id="SSH.NET" version="2013.4.7" targetFramework="net45" />
</packages>