Skip to content

Commit

Permalink
loadSpaceStatistics - explicit EXTENSION
Browse files Browse the repository at this point in the history
Signed-off-by: qGYdXbY2 <[email protected]>
  • Loading branch information
qGYdXbY2 committed Dec 6, 2024
1 parent 219cbf3 commit 1519fc1
Showing 1 changed file with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import com.here.xyz.jobs.steps.impl.transport.CopySpacePre;
import com.here.xyz.jobs.steps.impl.transport.CopySpacePost;
import com.here.xyz.models.hub.Ref;
import com.here.xyz.models.hub.Space;
import com.here.xyz.responses.StatisticsResponse;
import com.here.xyz.util.web.HubWebClient;
import com.here.xyz.util.web.XyzWebClient.WebClientException;
Expand Down Expand Up @@ -64,15 +65,23 @@ private static int threadCountCalc( long sourceFeatureCount, long targetFeatureC
return PARALLELIZTATION_THREAD_MAX;
}


private static StatisticsResponse _loadSpaceStatistics(String spaceId) throws WebClientException
{
Space sourceSpace = HubWebClient.getInstance(Config.instance.HUB_ENDPOINT).loadSpace(spaceId);
boolean isExtended = sourceSpace.getExtension() != null;
return HubWebClient.getInstance(Config.instance.HUB_ENDPOINT).loadSpaceStatistics(spaceId, isExtended ? SpaceContext.EXTENSION : null);
}

public static CompilationStepGraph compileSteps(String sourceId, String targetId, String jobId, Filters filters, Ref versionRef)
{
final String sourceSpaceId = sourceId,
targetSpaceId = targetId;

StatisticsResponse sourceStatistics = null, targetStatistics = null;
try {
sourceStatistics = HubWebClient.getInstance(Config.instance.HUB_ENDPOINT).loadSpaceStatistics(sourceSpaceId,SpaceContext.EXTENSION);
targetStatistics = HubWebClient.getInstance(Config.instance.HUB_ENDPOINT).loadSpaceStatistics(targetSpaceId,SpaceContext.EXTENSION);
sourceStatistics = _loadSpaceStatistics(sourceSpaceId);
targetStatistics = _loadSpaceStatistics(targetSpaceId);
} catch (WebClientException e) {
String errMsg = String.format("Unable to get Staistics for %s", sourceStatistics == null ? sourceSpaceId : targetSpaceId );
throw new JobCompiler.CompilationError(errMsg);
Expand Down

0 comments on commit 1519fc1

Please sign in to comment.