Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial preparation for supporting writing to any/all cdf targets #435

Merged
merged 34 commits into from
Jul 28, 2023
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
b73a0c8
proposed
toondaey Jun 28, 2023
b450ec5
latest
renovate[bot] Jun 27, 2023
fa3bd31
test: fix last failing test
toondaey Jun 29, 2023
788763c
Merge remote-tracking branch 'origin/master' into support-writing-to-…
toondaey Jun 29, 2023
455d5a3
feat: segregation
toondaey Jul 4, 2023
7bdfc2d
refactor: extract writers
toondaey Jul 4, 2023
8007bd3
Merge remote-tracking branch 'origin/master' into support-writing-to-…
toondaey Jul 4, 2023
43b872e
test: fix failing tests
toondaey Jul 5, 2023
ecc6e87
test: fix failing test
toondaey Jul 5, 2023
5722538
refactor: remove cancellation token from constructors
toondaey Jul 5, 2023
f32c279
fix: fix config
toondaey Jul 5, 2023
f9ce232
feat: integrate new config pattern
toondaey Jul 6, 2023
70fe544
docs: include methods documentations
toondaey Jul 9, 2023
39bb59e
style: deprecate property
toondaey Jul 9, 2023
055eba1
docs: json docs
toondaey Jul 10, 2023
39f874f
Merge master into support-writing-to-all/dog-1760
cognite-bulldozer[bot] Jul 24, 2023
74ce0ea
Merge refs/heads/master into support-writing-to-all/dog-1760
cognite-bulldozer[bot] Jul 24, 2023
672e7a8
style: rename config
toondaey Jul 24, 2023
5638738
refactor: abstract away
toondaey Jul 25, 2023
74daae8
feat: abstract timeseries
toondaey Jul 25, 2023
7e6fb95
docs: update use of metdata targets
toondaey Jul 25, 2023
bf4f439
fix: failing tests
toondaey Jul 25, 2023
fd95145
fix: failing test
toondaey Jul 25, 2023
e52f1a1
test: test all pusher destination
toondaey Jul 26, 2023
0a1d40c
test: remove all clear from all destination test
toondaey Jul 26, 2023
7deb336
test: without all destination
toondaey Jul 26, 2023
503a386
fix: failing test
toondaey Jul 26, 2023
57a065a
Merge refs/heads/master into support-writing-to-all/dog-1760
cognite-bulldozer[bot] Jul 27, 2023
92af8b2
Merge refs/heads/master into support-writing-to-all/dog-1760
cognite-bulldozer[bot] Jul 27, 2023
c0bff31
Merge refs/heads/master into support-writing-to-all/dog-1760
cognite-bulldozer[bot] Jul 27, 2023
d148877
fix: failing test
toondaey Jul 27, 2023
a45519e
fix: failing test
toondaey Jul 27, 2023
25c1fbb
docs: documentation updated
toondaey Jul 27, 2023
62b4864
Merge refs/heads/master into support-writing-to-all/dog-1760
cognite-bulldozer[bot] Jul 28, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@
]
}
}
}
}
5 changes: 5 additions & 0 deletions Extractor/BrowseCallback.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,15 @@ public class BrowseReport
{
public string? IdPrefix { get; set; }
public int AssetsUpdated { get; set; }
public int RawAssetsUpdated { get; set; }
public int AssetsCreated { get; set; }
public int RawAssetsCreated { get; set; }
public int TimeSeriesUpdated { get; set; }
public int RawTimeseriesUpdated { get; set; }
public int TimeSeriesCreated { get; set; }
public int RawTimeseriesCreated { get; set; }
public int RelationshipsCreated { get; set; }
public int RawRelationshipsCreated { get; set; }
public int MinimalTimeSeriesCreated { get; set; }
public string? RawDatabase { get; set; }
public string? AssetsTable { get; set; }
Expand Down
37 changes: 37 additions & 0 deletions Extractor/Config/CogniteConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ You should have received a copy of the GNU General Public License

using Cognite.Extensions;
using Cognite.Extractor.Utils;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
Expand Down Expand Up @@ -56,6 +57,7 @@ public class CognitePusherConfig : CogniteConfig, IPusherConfig
/// similarly to raw-metadata, and datapoints will be pushed. Nothing will be written to raw, and no assets will be created.
/// Events will be created, but without asset context.
/// </summary>
[Obsolete("Deprecated!")]
public bool SkipMetadata { get; set; }
/// <summary>
/// Store assets and/or timeseries data in raw. Assets will not be created at all,
Expand All @@ -65,6 +67,7 @@ public class CognitePusherConfig : CogniteConfig, IPusherConfig
/// of the source node is added to metadata if applicable.
/// Use different table names for assets and timeseries.
/// </summary>
[Obsolete("Deprecated! Use MetadataTargetsConfig.RawMetadataTargetConfig instead.")]
public RawMetadataConfig? RawMetadata { get; set; }
/// <summary>
/// Map metadata to asset/timeseries attributes. Each of "assets" and "timeseries" is a map from property DisplayName to
Expand Down Expand Up @@ -114,7 +117,13 @@ public double? NonFiniteReplacement
/// <summary>
/// Configuration for writing to a custom OPC-UA flexible data model.
/// </summary>
[Obsolete("Deprecated! Use MetadataTargetsConfig.FdmDestinationConfig instead.")]
public FdmDestinationConfig? FlexibleDataModels { get; set; }

/// <summary>
/// This is the implementation of the metadata targets
/// </summary>
public MetadataTargetsConfig? MetadataTargets { get; set; }
}
public class RawMetadataConfig
{
Expand All @@ -136,6 +145,34 @@ public class RawMetadataConfig
/// </summary>
public string? RelationshipsTable { get; set; }
}
public class MetadataTargetsConfig
{
/// <summary>
/// Raw metadata targets config
/// </summary>
public RawMetadataTargetConfig? RawMetadata { get; set; }
/// <summary>
/// Clean metadata targets config
/// </summary>
public CleanMetadataTargetConfig? CleanMetadata { get; set; }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just call this clean, and raw

/// <summary>
/// FDM destination config
/// </summary>
public FdmDestinationConfig? FlexibleDataModels { get; set; }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be data-models

}
public class RawMetadataTargetConfig
{
public string? Database { get; set; }
public string? AssetsTable { get; set; }
public string? TimeseriesTable { get; set; }
public string? RelationshipsTable { get; set; }
}
public class CleanMetadataTargetConfig
{
public bool Assets { get; set; } = true;
public bool Timeseries { get; set; } = true;
public bool Relationships { get; set; } = true;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These shouldn't be true by default

}
public class MetadataMapConfig
{
public Dictionary<string, string>? Assets { get; set; }
Expand Down
2 changes: 1 addition & 1 deletion Extractor/NodeSources/NodeSetSource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ private async Task InitNodes(IEnumerable<BaseUANode> nodes, CancellationToken to

await InitNodes(NodeList, token);

var usesFdm = Config.Cognite?.FlexibleDataModels?.Enabled ?? false;
var usesFdm = Config.Cognite?.MetadataTargets?.FlexibleDataModels?.Enabled ?? false;

if (Config.Extraction.Relationships.Enabled)
{
Expand Down
2 changes: 1 addition & 1 deletion Extractor/NodeSources/UANodeSource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ private async Task InitNodes(IEnumerable<BaseUANode> nodes, CancellationToken to

await InitNodes(NodeList, token);

var usesFdm = Config.Cognite?.FlexibleDataModels?.Enabled ?? false;
var usesFdm = Config.Cognite?.MetadataTargets?.FlexibleDataModels?.Enabled ?? false;

if (Config.Extraction.Relationships.Enabled)
{
Expand Down
2 changes: 1 addition & 1 deletion Extractor/Nodes/UADataType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public DataTypeAttributes() : base(NodeClass.DataType)

public override IEnumerable<uint> GetAttributeSet(FullConfig config)
{
if (config.Cognite?.FlexibleDataModels?.Enabled ?? false)
if (config.Cognite?.MetadataTargets?.FlexibleDataModels?.Enabled ?? false)
{
yield return Attributes.DataTypeDefinition;
}
Expand Down
Loading