Skip to content

Commit

Permalink
Merge refs/heads/master into renovate/cognite.extractorutils-1.x
Browse files Browse the repository at this point in the history
  • Loading branch information
cognite-bulldozer[bot] authored Oct 22, 2024
2 parents b6cedf6 + c9b04a9 commit f07b54d
Show file tree
Hide file tree
Showing 21 changed files with 45 additions and 45 deletions.
2 changes: 1 addition & 1 deletion Extractor/Config/CogniteConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ You should have received a copy of the GNU General Public License
using Cognite.Extensions;
using Cognite.Extractor.Common;
using Cognite.Extractor.Utils;
using CogniteSdk.Beta.DataModels;
using CogniteSdk.DataModels;
using System;
using System.Collections.Generic;
using System.ComponentModel;
Expand Down
6 changes: 3 additions & 3 deletions Extractor/Extractor.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
<PackageReference Include="AdysTech.InfluxDB.Client.Net.Core" Version="0.25.0" />
<PackageReference Include="Cognite.ExtractorUtils" Version="1.27.1" />
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Client" Version="1.5.374.78" />
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Configuration" Version="1.5.374.78" />
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.PubSub" Version="1.5.374.78-beta" />
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Client" Version="1.5.374.118" />
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Configuration" Version="1.5.374.118" />
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.PubSub" Version="1.5.374.118-beta" />
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />
<PackageReference Include="MQTTnet" Version="4.3.7.1207" />
<PackageReference Include="System.Text.Json" Version="8.0.5" />
Expand Down
4 changes: 2 additions & 2 deletions Extractor/Nodes/UAVariable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ You should have received a copy of the GNU General Public License
using Cognite.OpcUa.TypeCollectors;
using Cognite.OpcUa.Types;
using CogniteSdk;
using CogniteSdk.Beta.DataModels;
using CogniteSdk.Beta.DataModels.Core;
using CogniteSdk.DataModels;
using CogniteSdk.DataModels.Core;
using Microsoft.Extensions.Logging;
using Opc.Ua;
using System;
Expand Down
9 changes: 4 additions & 5 deletions Extractor/Pushers/CDFPusher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,15 @@ You should have received a copy of the GNU General Public License
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */

using Cognite.Extensions;
using Cognite.Extractor.Utils.Beta;
using Cognite.Extractor.Utils;
using Cognite.OpcUa.Config;
using Cognite.OpcUa.History;
using Cognite.OpcUa.Nodes;
using Cognite.OpcUa.NodeSources;
using Cognite.OpcUa.Pushers.Writers;
using Cognite.OpcUa.Types;
using CogniteSdk;
using CogniteSdk.Alpha;
using CogniteSdk.Beta.DataModels;
using CogniteSdk.DataModels;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Prometheus;
Expand Down Expand Up @@ -136,7 +135,7 @@ public CDFPusher(
if (config.MetadataTargets?.Clean?.Space != null)
{
var inserts = dataPointList.ToDictionary(
kvp => IdentityWithInstanceId.Create(new InstanceIdentifier(config.MetadataTargets.Clean.Space, kvp.Key)),
kvp => Identity.Create(new InstanceIdentifier(config.MetadataTargets.Clean.Space, kvp.Key)),
kvp => kvp.Value.SelectNonNull(dp => dp.ToCDFDataPoint(fullConfig.Extraction.StatusCodes.IngestStatusCodes, log))
);
return await PushDataPointsIdm(inserts, count, token);
Expand Down Expand Up @@ -520,7 +519,7 @@ CancellationToken token
#endregion

#region datapoints
private async Task<bool?> PushDataPointsIdm(Dictionary<IdentityWithInstanceId, IEnumerable<Datapoint>> inserts, int totalCount, CancellationToken token)
private async Task<bool?> PushDataPointsIdm(Dictionary<Identity, IEnumerable<Datapoint>> inserts, int totalCount, CancellationToken token)
{
try
{
Expand Down
2 changes: 1 addition & 1 deletion Extractor/Pushers/FDM/BaseDataModelDefinitions.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using CogniteSdk.Beta.DataModels;
using CogniteSdk.DataModels;
using System.Collections.Generic;

namespace Cognite.OpcUa.Pushers.FDM
Expand Down
2 changes: 1 addition & 1 deletion Extractor/Pushers/FDM/DMSValueConverter.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Cognite.OpcUa.Config;
using Cognite.OpcUa.Types;
using CogniteSdk.Beta.DataModels;
using CogniteSdk.DataModels;
using Opc.Ua;
using System;
using System.Collections;
Expand Down
24 changes: 12 additions & 12 deletions Extractor/Pushers/FDM/FDMWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ You should have received a copy of the GNU General Public License
using System.Threading;
using System.Threading.Tasks;
using Cognite.OpcUa.Config;
using CogniteSdk.Beta.DataModels;
using CogniteSdk.DataModels;
using System.Text.Json;
using System;
using Cognite.OpcUa.Nodes;
Expand Down Expand Up @@ -69,7 +69,7 @@ private async Task IngestInstances(IEnumerable<BaseInstanceWrite> instances, int
};
try
{
results[idx] = await destination.CogniteClient.Beta.DataModels.UpsertInstances(req, token);
results[idx] = await destination.CogniteClient.DataModels.UpsertInstances(req, token);
}
catch (ResponseException rex)
{
Expand All @@ -96,11 +96,11 @@ private async Task InitializeSpaceAndServer(CancellationToken token)

var spaces = new[] { modelInfo.InstanceSpace, modelInfo.ModelSpace }.Distinct();

await destination.CogniteClient.Beta.DataModels.UpsertSpaces(spaces.Select(s => new SpaceCreate { Space = s, Name = s }), token);
await destination.CogniteClient.DataModels.UpsertSpaces(spaces.Select(s => new SpaceCreate { Space = s, Name = s }), token);

var serverMetaContainer = BaseDataModelDefinitions.ServerMeta(modelInfo.ModelSpace);
await destination.CogniteClient.Beta.DataModels.UpsertContainers(new[] { serverMetaContainer }, token);
await destination.CogniteClient.Beta.DataModels.UpsertViews(new[] { serverMetaContainer.ToView(modelInfo.ModelVersion) }, token);
await destination.CogniteClient.DataModels.UpsertContainers(new[] { serverMetaContainer }, token);
await destination.CogniteClient.DataModels.UpsertViews(new[] { serverMetaContainer.ToView(modelInfo.ModelVersion) }, token);
}

private static bool IsConnectionDefEqual(ConnectionDefinition lh, ConnectionDefinition rh)
Expand Down Expand Up @@ -209,7 +209,7 @@ private async Task Initialize(FDMTypeBatch types, CancellationToken token)
// Check if the data model exists
try
{
var existingModels = await destination.CogniteClient.Beta.DataModels.RetrieveDataModels(new[] { modelInfo.FDMExternalId("OPC_UA") }, true, token);
var existingModels = await destination.CogniteClient.DataModels.RetrieveDataModels(new[] { modelInfo.FDMExternalId("OPC_UA") }, true, token);

if (existingModels.Any())
{
Expand Down Expand Up @@ -242,15 +242,15 @@ private async Task Initialize(FDMTypeBatch types, CancellationToken token)
foreach (var chunk in containersToInsert.ChunkBy(fdmConfig.ModelChunk))
{
log.LogDebug("Creating {Count} containers", chunk.Count());
await destination.CogniteClient.Beta.DataModels.UpsertContainers(chunk, token);
await destination.CogniteClient.DataModels.UpsertContainers(chunk, token);
}

foreach (var level in viewsToInsert.ChunkByHierarchy(fdmConfig.ModelChunk, v => v.ExternalId, v => v.Implements?.FirstOrDefault()?.ExternalId!))
{
foreach (var chunk in level.ChunkBy(fdmConfig.ModelChunk))
{
log.LogDebug("Creating {Count} views", chunk.Count());
await destination.CogniteClient.Beta.DataModels.UpsertViews(chunk, token);
await destination.CogniteClient.DataModels.UpsertViews(chunk, token);
}
}

Expand All @@ -264,7 +264,7 @@ private async Task Initialize(FDMTypeBatch types, CancellationToken token)
.Select(v => modelInfo.ViewIdentifier(v.ExternalId))
.Append(modelInfo.ViewIdentifier("ServerMeta"))
};
await destination.CogniteClient.Beta.DataModels.UpsertDataModels(new[] { model }, token);
await destination.CogniteClient.DataModels.UpsertDataModels(new[] { model }, token);
}

public async Task<bool> PushNodes(
Expand Down Expand Up @@ -456,7 +456,7 @@ private async Task<NodeIdContext> SyncServerMeta(NamespaceTable namespaces, Canc

List<string>? finalNamespaces = null;

await destination.CogniteClient.Beta.DataModels.UpsertAtomic<Dictionary<string, Dictionary<string, ServerMeta>>>(
await destination.CogniteClient.DataModels.UpsertAtomic<Dictionary<string, Dictionary<string, ServerMeta>>>(
new[] { externalId },
modelInfo.InstanceSpace,
InstanceType.node,
Expand Down Expand Up @@ -527,7 +527,7 @@ private async Task DeleteInstances(IEnumerable<InstanceIdentifierWithType> insta
var generators = chunks
.Select<IEnumerable<InstanceIdentifierWithType>, Func<Task>>(c => async () =>
{
await destination.CogniteClient.Beta.DataModels.DeleteInstances(
await destination.CogniteClient.DataModels.DeleteInstances(
instances,
token
);
Expand Down Expand Up @@ -564,7 +564,7 @@ private async Task<IEnumerable<InstanceIdentifierWithType>> GetAllReferencingEdg
string? cursor = null;
do
{
var r = await destination.CogniteClient.Beta.DataModels.FilterInstances<JsonElement>(new InstancesFilter
var r = await destination.CogniteClient.DataModels.FilterInstances<JsonElement>(new InstancesFilter
{
IncludeTyping = false,
InstanceType = InstanceType.edge,
Expand Down
2 changes: 1 addition & 1 deletion Extractor/Pushers/FDM/InstanceBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
using Cognite.OpcUa.Nodes;
using Cognite.OpcUa.Pushers.FDM.Types;
using Cognite.OpcUa.Types;
using CogniteSdk.Beta.DataModels;
using CogniteSdk.DataModels;
using Microsoft.Extensions.Logging;
using Opc.Ua;

Expand Down
2 changes: 1 addition & 1 deletion Extractor/Pushers/FDM/TypeHierarchyBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using Cognite.Extensions.DataModels;
using Cognite.OpcUa.Config;
using Cognite.OpcUa.Pushers.FDM.Types;
using CogniteSdk.Beta.DataModels;
using CogniteSdk.DataModels;
using Microsoft.Extensions.Logging;
using Opc.Ua;

Expand Down
2 changes: 1 addition & 1 deletion Extractor/Pushers/FDM/Types/ReferenceTypes.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Cognite.OpcUa.Nodes;
using Cognite.OpcUa.Types;
using CogniteSdk.Beta.DataModels;
using CogniteSdk.DataModels;
using Opc.Ua;
using System.Collections.Generic;

Expand Down
2 changes: 1 addition & 1 deletion Extractor/Pushers/MqttPusher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ public void Reset()
private async Task<bool> PushDataPointsChunk(IDictionary<string, IEnumerable<UADataPoint>> dataPointList, CancellationToken token)
{
var inserts = dataPointList.ToDictionary(
pair => (IIdentity)Identity.Create(pair.Key),
pair => Identity.Create(pair.Key),
pair => pair.Value.SelectNonNull(dp => dp.ToCDFDataPoint(fullConfig.Extraction.StatusCodes.IngestStatusCodes, log)));
var (points, errors) = Sanitation.CleanDataPointsRequest(inserts, SanitationMode.Clean, config.NonFiniteReplacement);
var cleaned = points.ToDictionary(pair => (Identity)pair.Key, pair => pair.Value);
Expand Down
10 changes: 5 additions & 5 deletions Extractor/Pushers/Writers/IdmWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
using Cognite.Extensions;
using Cognite.Extensions.DataModels.CogniteExtractorExtensions;
using Cognite.Extractor.Common;
using Cognite.Extractor.Utils.Beta;
using Cognite.Extractor.Utils;
using Cognite.OpcUa.Config;
using Cognite.OpcUa.Nodes;
using Cognite.OpcUa.Types;
using CogniteSdk.Beta.DataModels;
using CogniteSdk.Beta.DataModels.Core;
using CogniteSdk.Resources.Beta;
using CogniteSdk.DataModels;
using CogniteSdk.DataModels.Core;
using CogniteSdk.Resources;
using CogniteSdk.Resources.DataModels;
using Microsoft.Extensions.Logging;

Expand Down Expand Up @@ -55,7 +55,7 @@ public IdmWriter(ILogger<IdmWriter> logger, CogniteDestinationWithIDM destinatio
cleanConfig = config.Cognite?.MetadataTargets?.Clean ?? throw new ArgumentException("Attempted to initialize IDM writer without clean config");
if (cleanConfig.Space == null) throw new ArgumentException("Attempted to initialize IDM writer without space ID");
space = cleanConfig.Space;
sources = new SourceSystemResource(destination.CogniteClient.Beta.DataModels);
sources = new SourceSystemResource(destination.CogniteClient.DataModels);
var sourceId = cleanConfig.Source;
if (string.IsNullOrWhiteSpace(sourceId))
{
Expand Down
1 change: 0 additions & 1 deletion Extractor/Pushers/Writers/WriterUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using System.Threading;
using System.Threading.Tasks;
using Cognite.Extractor.Utils;
using Cognite.Extractor.Utils.Beta;
using Cognite.OpcUa.Config;
using Cognite.OpcUa.Pushers.FDM;
using CogniteSdk;
Expand Down
4 changes: 4 additions & 0 deletions Extractor/SessionManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,10 @@ private void ClientKeepAlive(ISession sender, KeepAliveEventArgs eventArgs)
}
});
}
else
{
log.LogWarning("Session manager is closed, not attempting to reconnect");
}
client.Callbacks.TaskScheduler.ScheduleTask(null, async (_) => await client.Callbacks.OnServerDisconnect(client));
}

Expand Down
1 change: 0 additions & 1 deletion ExtractorLauncher/ExtractorStarter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ You should have received a copy of the GNU General Public License
using Cognite.Extractor.Configuration;
using Cognite.Extractor.Logging;
using Cognite.Extractor.Utils;
using Cognite.Extractor.Utils.Beta;
using Cognite.OpcUa.Config;
using Cognite.OpcUa.Pushers;
using Cognite.OpcUa.Pushers.Writers;
Expand Down
6 changes: 3 additions & 3 deletions Server/Server.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="Microsoft.NETCore.Platforms" Version="7.0.4" />
<PackageReference Include="MQTTnet" Version="4.3.7.1207" />
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Configuration" Version="1.5.374.78" />
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.PubSub" Version="1.5.374.78-beta" />
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Server" Version="1.5.374.78" />
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Configuration" Version="1.5.374.118" />
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.PubSub" Version="1.5.374.118-beta" />
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Server" Version="1.5.374.118" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion Test/CDFMockHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */

using CogniteSdk;
using CogniteSdk.Beta.DataModels;
using CogniteSdk.DataModels;
using Com.Cognite.V1.Timeseries.Proto;
using Google.Protobuf;
using Microsoft.Extensions.Logging;
Expand Down
4 changes: 2 additions & 2 deletions Test/Integration/NodeExtractionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1107,7 +1107,7 @@ public async Task TestPropertyInheritance()
+ @"""Variable StringArray"":[""test1"",""test2""],""StringyVar"":null,""IgnoreVar"":null,"
+ @"""MysteryVar"":{""Value"":null,""EngineeringUnits"":""°C: degree Celsius"",""EURange"":""(0, 100)""},"
+ @"""NumberVar"":{""Value"":null,""DeepProp"":{""DeepProp2"":{""val1"":""value 1"",""val2"":""value 2""}}},"
+ @"""EnumVar1"":""Enum2"",""EnumVar3"":[""VEnum2"",""VEnum2"",""VEnum1"",""VEnum2""],""EnumVar2"":""VEnum2""}}", metaString);
+ @"""EnumVar1"":""Enum2"",""EnumVar2"":""VEnum2"",""EnumVar3"":[""VEnum2"",""VEnum2"",""VEnum1"",""VEnum2""]}}", metaString);
}
[Fact]
public async Task TestArrayPropertiesWithoutMaxArraySize()
Expand Down Expand Up @@ -1154,7 +1154,7 @@ public async Task TestArrayPropertiesWithoutMaxArraySize()
+ @"""Variable StringArray"":[""test1"",""test2""],""StringyVar"":null,""IgnoreVar"":null,"
+ @"""MysteryVar"":{""Value"":null,""EngineeringUnits"":""°C: degree Celsius"",""EURange"":""(0, 100)""},"
+ @"""NumberVar"":{""Value"":null,""DeepProp"":{""DeepProp2"":{""val1"":""value 1"",""val2"":""value 2""}}},"
+ @"""EnumVar1"":1,""EnumVar3"":[123,123,321,123],""EnumVar2"":123}}", metaString);
+ @"""EnumVar1"":1,""EnumVar2"":123,""EnumVar3"":[123,123,321,123]}}", metaString);
}
[Fact]
public async Task TestLateIgnore()
Expand Down
2 changes: 1 addition & 1 deletion Test/Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Cognite.Extractor.Testing" Version="1.26.1" />
<PackageReference Include="Cognite.Extractor.Testing" Version="1.27.1" />
<PackageReference Include="coverlet.msbuild" Version="6.0.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand Down
2 changes: 1 addition & 1 deletion Test/Unit/CDFPusherTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
using Cognite.OpcUa.Subscriptions;
using Cognite.OpcUa.Types;
using CogniteSdk;
using CogniteSdk.Beta.DataModels;
using CogniteSdk.DataModels;
using Com.Cognite.V1.Timeseries.Proto;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
Expand Down
1 change: 0 additions & 1 deletion Test/Utils/BaseExtractorTestFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
using System.Linq;
using Opc.Ua.Client;
using Cognite.OpcUa.Subscriptions;
using Cognite.Extractor.Utils.Beta;

namespace Test.Utils
{
Expand Down

0 comments on commit f07b54d

Please sign in to comment.