Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • Fix/xxxx-oldSchool
  • Hotfix/2352-onlyChanged
  • Hotfix/2615-graphDeployerLag
  • Hotfix/790-orgDeploy
  • Hotfix/953-fileNameWithSpace
  • Hotfix/999-fixGraphdeployer
  • Hotfix/xxxx-directoryDependency
  • Hotfix/xxxx-fastDeployment
  • Issue/2518-docs
  • Issue/2568-betterLogging
  • Issue/2668-graphDeployer
  • Issue/2880-gd
  • Issue/2906-containerCron
  • Issue/2915-migrateSql2Linked
  • Issue/2944-gdShenanigans
  • Issue/2967-fixGD
  • Issue/2980-fixContainerBuild
  • Issue/3109-onboarding
  • Issue/3130-onboardingUzK
  • Issue/xxxx-fixDevcontainer
  • Issue/xxxx-generateLatestTag
  • Product/483-organizations
  • Product/871-generalDeployment
  • Sprint/2020-07
  • Sprint/2020-11
  • Sprint/2020-12
  • Sprint/2022-01
  • Topic/711-organizations
  • Topic/713-rwthOrgState
  • Topic/886-generalDeployment
  • dev
  • gitkeep
  • master
  • petar.hristov-master-patch-9e49
  • test_ci
  • v1.1.0
  • v1.1.1
  • v1.2.0
  • v1.2.1
  • v1.2.10
  • v1.2.11
  • v1.2.2
  • v1.2.3
  • v1.2.4
  • v1.2.5
  • v1.2.6
  • v1.2.7
  • v1.2.8
  • v1.2.9
  • v2.0.0
  • v2.0.1
  • v2.1.0
  • v2.1.1
  • v2.1.10
  • v2.1.11
  • v2.1.2
  • v2.1.3
  • v2.1.4
  • v2.1.5
  • v2.1.6
  • v2.1.7
  • v2.1.8
  • v2.1.9
63 results

Target

Select target project
  • coscine/backend/scripts/graphdeployer
1 result
Select Git revision
  • Fix/xxxx-oldSchool
  • Hotfix/2352-onlyChanged
  • Hotfix/2615-graphDeployerLag
  • Hotfix/790-orgDeploy
  • Hotfix/953-fileNameWithSpace
  • Hotfix/999-fixGraphdeployer
  • Hotfix/xxxx-directoryDependency
  • Hotfix/xxxx-fastDeployment
  • Issue/2518-docs
  • Issue/2568-betterLogging
  • Issue/2668-graphDeployer
  • Issue/2880-gd
  • Issue/2906-containerCron
  • Issue/2915-migrateSql2Linked
  • Issue/2944-gdShenanigans
  • Issue/2967-fixGD
  • Issue/2980-fixContainerBuild
  • Issue/3109-onboarding
  • Issue/3130-onboardingUzK
  • Issue/xxxx-fixDevcontainer
  • Issue/xxxx-generateLatestTag
  • Product/483-organizations
  • Product/871-generalDeployment
  • Sprint/2020-07
  • Sprint/2020-11
  • Sprint/2020-12
  • Sprint/2022-01
  • Topic/711-organizations
  • Topic/713-rwthOrgState
  • Topic/886-generalDeployment
  • dev
  • gitkeep
  • master
  • petar.hristov-master-patch-9e49
  • test_ci
  • v1.1.0
  • v1.1.1
  • v1.2.0
  • v1.2.1
  • v1.2.10
  • v1.2.11
  • v1.2.2
  • v1.2.3
  • v1.2.4
  • v1.2.5
  • v1.2.6
  • v1.2.7
  • v1.2.8
  • v1.2.9
  • v2.0.0
  • v2.0.1
  • v2.1.0
  • v2.1.1
  • v2.1.10
  • v2.1.11
  • v2.1.2
  • v2.1.3
  • v2.1.4
  • v2.1.5
  • v2.1.6
  • v2.1.7
  • v2.1.8
  • v2.1.9
63 results
Show changes
Commits on Source (3)
......@@ -7,7 +7,7 @@
<AssemblyName>Coscine.GraphDeployer</AssemblyName>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Version>1.2.8</Version>
<Version>1.2.9</Version>
</PropertyGroup>
<PropertyGroup>
......
using System.Security.Cryptography;
namespace Coscine.GraphDeployer
{
public static class HashUtil
{
public static string GetFileHash(string path)
{
using (SHA256 sha256 = SHA256.Create())
{
using (FileStream fileStream = File.OpenRead(path))
{
return BitConverter.ToString(sha256.ComputeHash(fileStream));
}
}
}
}
}
......@@ -3,6 +3,7 @@ using Coscine.GraphDeployer.Logging;
using Coscine.Metadata;
using LibGit2Sharp;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using NLog.Config;
using NLog.Extensions.Logging;
using System.Diagnostics;
......@@ -41,6 +42,10 @@ public class Program
private static void Run()
{
var currentRun = new Dictionary<string, string>();
var lastRun = JsonConvert.DeserializeObject<Dictionary<string, string>>(Configuration.GetString("coscine/local/graph_deployer/last_run", "{}"));
lastRun ??= new Dictionary<string, string>();
var virtuosoServer = Configuration.GetString("coscine/local/virtuoso/additional/url");
var virtuosoHost = new Uri(virtuosoServer).Host;
var virtuosoUser = Configuration.GetString("coscine/global/virtuoso_db_user");
......@@ -111,6 +116,15 @@ public class Program
{
var graph = kv.Value.Item1;
var graphName = kv.Key.ToString();
kv.Value.Item2.ForEach((path) => currentRun.TryAdd(graphName + path, HashUtil.GetFileHash(path)));
var changed = kv.Value.Item2.Any((path) =>
!lastRun.ContainsKey(graphName + path) || lastRun[graphName + path] != currentRun[graphName + path]);
if (!changed)
{
_logger.LogInformation("Skipping {graphName}", graphName);
continue;
}
var currentGraph = Helpers.WrapRequest(() => _rdfStoreConnector.GetGraph(graphName));
......@@ -121,8 +135,12 @@ public class Program
var graphWasChanged = graph.Triples.Count != currentGraph.Triples.Count
|| projectedGraph.Except(projectedCurrentGraph).Any();
if (graphWasChanged)
if (!graphWasChanged)
{
_logger.LogInformation("Skipping {graphName}", graphName);
continue;
}
if (!currentGraph.IsEmpty)
{
Helpers.WrapRequest(() => _rdfStoreConnector.ClearGraph(graphName));
......@@ -139,11 +157,6 @@ public class Program
queries.Add($"ld_dir('{fileInfo.DirectoryName[2..].Replace("\\", "/")}', '{fileInfo.Name}', '{graphName}');");
}
}
else
{
_logger.LogInformation("Skipping {graphName}", graphName);
}
}
queries.Add($"rdf_loader_run ();");
queries.Add($"DELETE from DB.DBA.load_list where 1=1;");
......@@ -159,6 +172,7 @@ public class Program
}
}
Configuration.Put("coscine/local/graph_deployer/last_run", JsonConvert.SerializeObject(currentRun));
_logger.LogInformation("Done");
}
......