forked from datahub-project/datahub
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "fix(upgrade): Improving NoCodeUpgrade logic to account for Bo…
…otstrap logic (datahub-project#3301)" This reverts commit cd2f159.
- Loading branch information
Showing
16 changed files
with
98 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
...ub-upgrade/src/main/java/com/linkedin/datahub/upgrade/nocode/IngestDataPlatformsStep.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
package com.linkedin.datahub.upgrade.nocode; | ||
|
||
import com.linkedin.common.AuditStamp; | ||
import com.linkedin.common.urn.DataPlatformUrn; | ||
import com.linkedin.common.urn.Urn; | ||
import com.linkedin.datahub.upgrade.UpgradeContext; | ||
import com.linkedin.datahub.upgrade.UpgradeStep; | ||
import com.linkedin.datahub.upgrade.UpgradeStepResult; | ||
import com.linkedin.datahub.upgrade.impl.DefaultUpgradeStepResult; | ||
import com.linkedin.dataplatform.DataPlatformInfo; | ||
import com.linkedin.metadata.utils.PegasusUtils; | ||
import com.linkedin.metadata.entity.EntityService; | ||
import com.linkedin.metadata.resources.dataplatform.utils.DataPlatformsUtil; | ||
import java.net.URISyntaxException; | ||
import java.time.Clock; | ||
import java.util.Map; | ||
import java.util.function.Function; | ||
|
||
|
||
public class IngestDataPlatformsStep implements UpgradeStep { | ||
|
||
private final EntityService _entityService; | ||
|
||
public IngestDataPlatformsStep(final EntityService entityService) { | ||
_entityService = entityService; | ||
} | ||
|
||
@Override | ||
public String id() { | ||
return "IngestDataPlatformsStep"; | ||
} | ||
|
||
@Override | ||
public int retryCount() { | ||
return 2; | ||
} | ||
|
||
@Override | ||
public Function<UpgradeContext, UpgradeStepResult> executable() { | ||
return (context) -> { | ||
|
||
context.report().addLine("Preparing to ingest DataPlatforms..."); | ||
|
||
Map<DataPlatformUrn, DataPlatformInfo> urnToInfo = DataPlatformsUtil.getDataPlatformInfoMap(); | ||
|
||
context.report().addLine(String.format("Found %s DataPlatforms", urnToInfo.keySet().size())); | ||
|
||
for (final Map.Entry<DataPlatformUrn, DataPlatformInfo> entry : urnToInfo.entrySet()) { | ||
AuditStamp auditStamp; | ||
try { | ||
auditStamp = new AuditStamp().setActor(Urn.createFromString("urn:li:principal:system")).setTime( | ||
Clock.systemUTC().millis()); | ||
} catch (URISyntaxException e) { | ||
throw new RuntimeException("Failed to create Actor Urn"); | ||
} | ||
|
||
_entityService.ingestAspect( | ||
entry.getKey(), | ||
PegasusUtils.getAspectNameFromSchema(entry.getValue().schema()), | ||
entry.getValue(), | ||
auditStamp | ||
); | ||
} | ||
|
||
context.report().addLine(String.format("Successfully ingested %s DataPlatforms.", urnToInfo.keySet().size())); | ||
return new DefaultUpgradeStepResult(id(), UpgradeStepResult.Result.SUCCEEDED); | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters