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-indexOutOfRange
  • Fix/xxxx-minorFixes
  • Fix/xxxx-organization
  • Fix/xxxx-wrap
  • Hotfix/2332-userInstitutesInReporting
  • Hotfix/2388-sensitive
  • Hotfix/3115-userReportingEmpty
  • Hotfix/3115-userReportingEmpty2
  • Hotfix/xxxx-rors
  • Issue/2181-kpiGeneratorBase
  • Issue/2182-kpiGeneratorUser
  • Issue/2183-kpiGeneratorResource
  • Issue/2184-kpiGeneratorProject
  • Issue/2185-kpiGeneratorAP
  • Issue/2186-systemStatusReporting
  • Issue/2283-activityFix
  • Issue/2304-virtuosoRoars
  • Issue/2330-fixNaNQuotainAdmin
  • Issue/2432-publicationKpi
  • Issue/2492-respOrg
  • Issue/2518-docs
  • Issue/2568-betterLogging
  • Issue/2666-adminCronjobs
  • Issue/2666-adminCronjobs-theSequal
  • Issue/2847-reporting
  • Issue/2850-removeGrantId
  • Issue/2982-kpiDataPub
  • Issue/3005-kpiReportingBroken
  • Issue/3073-kpi
  • Issue/3142-kpiGenerator
  • dev
  • gitkeep
  • main
  • v0.1.0
  • v0.1.1
  • v0.1.10
  • v0.1.11
  • v0.1.12
  • v0.1.13
  • v0.1.14
  • v0.1.15
  • v0.1.16
  • v0.1.17
  • v0.1.18
  • v0.1.19
  • v0.1.2
  • v0.1.20
  • v0.1.21
  • v0.1.22
  • v0.1.23
  • v0.1.3
  • v0.1.4
  • v0.1.5
  • v0.1.6
  • v0.1.7
  • v0.1.8
  • v0.1.9
  • v1.0.1
  • v1.0.2
  • v1.0.3
  • v1.0.4
  • v1.0.5
  • v1.0.6
  • v1.0.7
  • v1.0.8
  • v1.0.9
  • v1.1.0
  • v1.1.1
  • v1.2.0
  • v1.2.1
  • v1.2.10
  • v1.2.2
  • v1.2.3
  • v1.2.4
  • v1.2.5
  • v1.2.6
  • v1.2.7
  • v1.2.8
  • v1.2.9
79 results

Target

Select target project
  • coscine/backend/scripts/kpi-generator
1 result
Select Git revision
  • Fix/xxxx-indexOutOfRange
  • Fix/xxxx-minorFixes
  • Fix/xxxx-organization
  • Fix/xxxx-wrap
  • Hotfix/2332-userInstitutesInReporting
  • Hotfix/2388-sensitive
  • Hotfix/3115-userReportingEmpty
  • Hotfix/3115-userReportingEmpty2
  • Hotfix/xxxx-rors
  • Issue/2181-kpiGeneratorBase
  • Issue/2182-kpiGeneratorUser
  • Issue/2183-kpiGeneratorResource
  • Issue/2184-kpiGeneratorProject
  • Issue/2185-kpiGeneratorAP
  • Issue/2186-systemStatusReporting
  • Issue/2283-activityFix
  • Issue/2304-virtuosoRoars
  • Issue/2330-fixNaNQuotainAdmin
  • Issue/2432-publicationKpi
  • Issue/2492-respOrg
  • Issue/2518-docs
  • Issue/2568-betterLogging
  • Issue/2666-adminCronjobs
  • Issue/2666-adminCronjobs-theSequal
  • Issue/2847-reporting
  • Issue/2850-removeGrantId
  • Issue/2982-kpiDataPub
  • Issue/3005-kpiReportingBroken
  • Issue/3073-kpi
  • Issue/3142-kpiGenerator
  • dev
  • gitkeep
  • main
  • v0.1.0
  • v0.1.1
  • v0.1.10
  • v0.1.11
  • v0.1.12
  • v0.1.13
  • v0.1.14
  • v0.1.15
  • v0.1.16
  • v0.1.17
  • v0.1.18
  • v0.1.19
  • v0.1.2
  • v0.1.20
  • v0.1.21
  • v0.1.22
  • v0.1.23
  • v0.1.3
  • v0.1.4
  • v0.1.5
  • v0.1.6
  • v0.1.7
  • v0.1.8
  • v0.1.9
  • v1.0.1
  • v1.0.2
  • v1.0.3
  • v1.0.4
  • v1.0.5
  • v1.0.6
  • v1.0.7
  • v1.0.8
  • v1.0.9
  • v1.1.0
  • v1.1.1
  • v1.2.0
  • v1.2.1
  • v1.2.10
  • v1.2.2
  • v1.2.3
  • v1.2.4
  • v1.2.5
  • v1.2.6
  • v1.2.7
  • v1.2.8
  • v1.2.9
79 results
Show changes
Commits on Source (3)
......@@ -7,7 +7,7 @@
<AssemblyName>Coscine.KpiGenerator</AssemblyName>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Version>0.1.9</Version>
<Version>0.1.10</Version>
</PropertyGroup>
<PropertyGroup>
......@@ -26,6 +26,7 @@
<PackageReference Include="GitLabApiClient" Version="1.8.1-beta.5" />
<PackageReference Include="NLog" Version="5.1.0" />
<PackageReference Include="NLog.Extensions.Logging" Version="5.2.0" />
<PackageReference Include="Polly.Extensions.Http" Version="3.0.0" />
</ItemGroup>
<ItemGroup>
......
......@@ -57,7 +57,7 @@ public class Program
catch (Exception e)
{
Console.WriteLine(e.Message);
_logger.LogError(e, e.Message);
_logger.LogWarning(e, e.Message);
return -1; // Exit Code -1 for Failure
}
}
......@@ -129,7 +129,7 @@ public class Program
{
if (ex.InnerException is not null)
{
_logger.LogError(ex.InnerException, "InnerException: {innerException}", ex.InnerException.Message);
_logger.LogWarning(ex.InnerException, "InnerException: {innerException}", ex.InnerException.Message);
LogInnerException(ex.InnerException);
}
}
......
......@@ -5,6 +5,7 @@ using GitLabApiClient;
using GitLabApiClient.Models.Branches.Requests;
using GitLabApiClient.Models.Commits.Requests.CreateCommitRequest;
using Microsoft.Extensions.Logging;
using Polly;
using System.Text;
using System.Web;
using VDS.RDF.Query;
......@@ -154,7 +155,7 @@ public abstract class Reporting<O> where O : class
catch (Exception e)
{
Console.WriteLine(e.Message);
_logger.LogError(e, e.Message);
_logger.LogWarning(e, e.Message);
return false;
}
}
......@@ -173,7 +174,7 @@ public abstract class Reporting<O> where O : class
}
else
{
var organizationTriples = RdfStoreConnector.GetLabelForSubject(new Uri(Uri.UnescapeDataString(rorUrl))).ToList();
var organizationTriples = WrapRequest(() => RdfStoreConnector.GetLabelForSubject(new Uri(Uri.UnescapeDataString(rorUrl))).ToList());
if (organizationTriples.Any())
{
result = new Organization
......@@ -261,4 +262,33 @@ public abstract class Reporting<O> where O : class
}
Console.WriteLine();
}
/// <summary>
/// Retry Virtuoso Requests since they sometimes just fail
/// </summary>
/// <typeparam name="W"></typeparam>
/// <param name="function"></param>
/// <returns></returns>
public void WrapRequest(Action action)
{
Policy
.Handle<Exception>()
.WaitAndRetry(5, retryNumber => TimeSpan.FromMilliseconds(200))
.Execute(() => action.Invoke());
}
/// <summary>
/// Retry Virtuoso Requests since they sometimes just fail
/// </summary>
/// <typeparam name="W"></typeparam>
/// <param name="function"></param>
/// <returns></returns>
public W WrapRequest<W>(Func<W> function)
{
return Policy
.Handle<Exception>()
.WaitAndRetry(5, retryNumber => TimeSpan.FromMilliseconds(200))
.ExecuteAndCapture(() => function.Invoke()).Result;
}
}
\ No newline at end of file
......@@ -53,7 +53,7 @@ public class ApplicationProfileReporting : Reporting<ApplicationProfileReporting
OPTIONAL {{ ?{_applicationProfile} dcterms:{_license} ?{_license} . }}
}}"
};
using var result = RdfStoreConnector.QueryEndpoint.QueryWithResultSet(queryString.ToString());
using var result = WrapRequest(() => RdfStoreConnector.QueryEndpoint.QueryWithResultSet(queryString.ToString()));
var grouped = result.GroupBy(ap => new
{
......
......@@ -29,7 +29,7 @@ public class CompleteReporting : Reporting<CompleteReportingOptions>
catch (Exception e)
{
Console.WriteLine($"!! Skipping ProjectReporting: {e.Message} \n");
_logger.LogWarning(e, "Skipping ProjectReporting: {message}", e.Message);
_logger.LogError(e, "Skipping ProjectReporting: {message}", e.Message);
}
// Resource Reporting
......@@ -43,7 +43,7 @@ public class CompleteReporting : Reporting<CompleteReportingOptions>
catch (Exception e)
{
Console.WriteLine($"!! Skipping ResourceReporting: {e.Message} \n");
_logger.LogWarning(e, "Skipping ResourceReporting: {message}", e.Message);
_logger.LogError(e, "Skipping ResourceReporting: {message}", e.Message);
}
// User Reporting
......@@ -57,7 +57,7 @@ public class CompleteReporting : Reporting<CompleteReportingOptions>
catch (Exception e)
{
Console.WriteLine($"!! Skipping UserReporting: {e.Message} \n");
_logger.LogWarning(e, "Skipping UserReporting: {message}", e.Message);
_logger.LogError(e, "Skipping UserReporting: {message}", e.Message);
}
// Application Profile Reporting
......@@ -71,7 +71,7 @@ public class CompleteReporting : Reporting<CompleteReportingOptions>
catch (Exception e)
{
Console.WriteLine($"!! Skipping ApplicationProfileReporting: {e.Message} \n");
_logger.LogWarning(e, "Skipping ApplicationProfileReporting: {message}", e.Message);
_logger.LogError(e, "Skipping ApplicationProfileReporting: {message}", e.Message);
}
// System Status Reporting
......@@ -85,7 +85,7 @@ public class CompleteReporting : Reporting<CompleteReportingOptions>
catch (Exception e)
{
Console.WriteLine($"!! Skipping SystemReporting: {e.Message} \n");
_logger.LogWarning(e, "Skipping SystemReporting: {message}", e.Message);
_logger.LogError(e, "Skipping SystemReporting: {message}", e.Message);
}
return result;
......
......@@ -164,7 +164,7 @@ public class ProjectReporting : Reporting<ProjectReportingOptions>
}
catch (Exception ex)
{
_logger.LogError(ex, ex.Message);
_logger.LogWarning(ex, ex.Message);
return 0f;
}
}
......@@ -198,7 +198,7 @@ public class ProjectReporting : Reporting<ProjectReportingOptions>
}
catch (Exception ex)
{
_logger.LogError(ex, ex.Message);
_logger.LogWarning(ex, ex.Message);
return 0f;
}
}
......
......@@ -135,7 +135,7 @@ public class ResourceReporting : Reporting<ResourceReportingOptions>
}
catch (Exception ex)
{
_logger.LogError(ex, "Error: {message} for {@resource}", ex.Message, resource);
_logger.LogWarning(ex, "Error: {message} for {@resource}", ex.Message, resource);
return null;
}
}
......
......@@ -245,7 +245,7 @@ public class UserReporting : Reporting<UserReportingOptions>
}}
"
};
using var results = RdfStoreConnector.QueryEndpoint.QueryWithResultSet(_queryString.ToString());
using var results = WrapRequest(() => RdfStoreConnector.QueryEndpoint.QueryWithResultSet(_queryString.ToString()));
if (!results.IsEmpty)
{
var ror = results.Select(x => x.Value("ror").ToString()); // Get the value for ?ror
......@@ -279,7 +279,7 @@ public class UserReporting : Reporting<UserReportingOptions>
}}
"
};
using var results = RdfStoreConnector.QueryEndpoint.QueryWithResultSet(_queryString.ToString());
using var results = WrapRequest(() => RdfStoreConnector.QueryEndpoint.QueryWithResultSet(_queryString.ToString()));
if (!results.IsEmpty)
{
var ror = results.Select(x => x.Value("ror").ToString()); // Get the value for ?ror
......
......@@ -8,7 +8,6 @@
<targets>
<!-- Write logs to File -->
<target xsi:type="File" name="fileLog" fileName="C:/coscine/logs/${assembly-name}/${assembly-version}/log-${shortdate}.log" >
<layout xsi:type="CompoundLayout">
<layout xsi:type="JsonLayout" EscapeForwardSlash="true">
<attribute layout="${longdate}" name="Timestamp"/>
<attribute layout="${level:upperCase=true}" name="Level"/>
......@@ -20,8 +19,6 @@
<layout xsi:type='JsonLayout' includeAllProperties="true" maxRecursionLimit="2"/>
</attribute>
</layout>
<layout xsi:type='SimpleLayout' text="," />
</layout>
</target>
</targets>
......