Skip to content

Commit

Permalink
HARMONY-1808: Change all tests and documentation using giovanni-adapt…
Browse files Browse the repository at this point in the history
…er to instead use harmony-service-example.
  • Loading branch information
chris-durbin committed Nov 19, 2024
1 parent 8cf9218 commit f29d16c
Show file tree
Hide file tree
Showing 12 changed files with 48 additions and 42 deletions.
2 changes: 1 addition & 1 deletion bin/create-dotenv
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ EOF
echo "KUBE_CONTEXT=minikube" >> .env
fi
else
echo -e "\nLOCALLY_DEPLOYED_SERVICES=harmony-service-example,giovanni-adapter\n" >> .env
echo -e "\nLOCALLY_DEPLOYED_SERVICES=harmony-service-example\n" >> .env
fi

fi
6 changes: 3 additions & 3 deletions config/services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ https://cmr.earthdata.nasa.gov:
- image: !Env ${QUERY_CMR_IMAGE}
is_sequential: true

- name: gesdisc/giovanni
- name: giovanni-time-series-adapter
description: |
A service to compose the Giovanni URL and invoke Giovanni service to produce output file to visualize, analyze,
A service to compose the Giovanni URL for a time series and invoke Giovanni service to produce output file to visualize, analyze,
and access vast amounts of Earth science remote sensing data without having to download the data.
data_operation_version: '0.20.0'
has_granule_limit: false
Expand All @@ -78,7 +78,7 @@ https://cmr.earthdata.nasa.gov:
output_formats:
- text/csv
steps:
- image: !Env ${GIOVANNI_ADAPTER_IMAGE}
- image: !Env ${GIOVANNI_TIME_SERIES_ADAPTER_IMAGE}
operations: ['variableSubset', 'temporalSubset']

- name: podaac/l2-subsetter
Expand Down
4 changes: 2 additions & 2 deletions docs/guides/managing-existing-services.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ The returned JSON response is a map of canonical service names to tags:
"podaac-ps3": "latest",
"podaac-netcdf-converter": "latest",
"query-cmr": "latest",
"giovanni-adapter": "latest",
"giovanni-time-series-adapter": "latest",
"geoloco": "latest",
"subset-band-name": "latest"
}
Expand Down Expand Up @@ -114,7 +114,7 @@ The returned JSON response has the fields indicating the current status of the s
{
"deploymentId": "befb50e0-e467-4776-86c8-e7218f1123cc",
"username": "yliu10",
"service": "giovanni-adapter",
"service": "harmony-service-example",
"tag": "new-version",
"regressionTestVersion": "1.0.0",
"status": "successful",
Expand Down
6 changes: 3 additions & 3 deletions services/harmony/app/backends/deployment-callback.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ import _ from 'lodash';
* image - full image url with tag for the deployed service
* serviceQueueUrls - a list contains the service image to queue url mapping as defined in HarmonyEnv class.
* Here is an example:
* \{"deployService":"giovanni-adapter",
* "image":"123456.dkr.ecr.us-west-2.amazonaws.com/harmonyservices/giovanni-adapter:latest",
* "serviceQueueUrls":"[\"123456.dkr.ecr.us-west-2.amazonaws.com/harmonyservices/giovanni-adapter:latest.....\"]"\}
* \{"deployService":"harmony-service-example",
* "image":"123456.dkr.ecr.us-west-2.amazonaws.com/harmonyservices/service-example:latest",
* "serviceQueueUrls":"[\"123456.dkr.ecr.us-west-2.amazonaws.com/harmonyservices/service-example:latest.....\"]"\}
* @param req - The request sent by the client
* @param res - The response to send to the client
*/
Expand Down
10 changes: 5 additions & 5 deletions services/harmony/app/frontends/request-metrics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const metricsFields = [
'reproject', 'synchronous', 'spatialSubset', 'shapefileSubset', 'chainLength',
'harmonyGdalAdapter', 'harmonyServiceExample', 'harmonyNetcdfToZarr', 'swathProjector',
'hoss', 'sdsMaskfill', 'trajectorySubsetter', 'podaacConcise',
'podaacL2Subsetter', 'giovanniAdapter',
'podaacL2Subsetter', 'giovanniTimeSeriesAdapter',
];

interface RequestMetrics {
Expand All @@ -29,7 +29,7 @@ interface RequestMetrics {
trajectorySubsetter: number;
podaacConcise: number;
podaacL2Subsetter: number;
giovanniAdapter: number;
giovanniTimeSeriesAdapter: number;
numInputGranules: number;
totalGranuleSizeMb: number;
timeTakenSeconds: number;
Expand Down Expand Up @@ -77,8 +77,8 @@ function getServiceNameFromID(serviceID: string, logger: Logger): string {
case /podaac\/l2ss-py/.test(serviceID):
serviceName = 'podaacL2Subsetter';
break;
case /giovanni-adapter/.test(serviceID):
serviceName = 'giovanniAdapter';
case /giovanni-time-series-adapter/.test(serviceID):
serviceName = 'giovanniTimeSeriesAdapter';
break;
case /query\-cmr/.test(serviceID):
break;
Expand All @@ -105,7 +105,7 @@ function getServiceMetricsFromSteps(steps: WorkflowStep[], logger: Logger): Part
trajectorySubsetter: 0,
podaacConcise: 0,
podaacL2Subsetter: 0,
giovanniAdapter: 0,
giovanniTimeSeriesAdapter: 0,
numVariables: 0,
concatenate: 0,
reproject: 0,
Expand Down
9 changes: 5 additions & 4 deletions services/harmony/env-defaults
Original file line number Diff line number Diff line change
Expand Up @@ -229,10 +229,11 @@ LOG_STDOUT=false
# The services to deploy locally. A comma-separated list of services that the bin/deploy-services
# script should attempt to deploy. By default only a couple of harmony example services are deployed.
# When specifying another service to be deployed make sure the name matches the lower and dash case
# prefix for the image variable name. For example to deploy the Giovanni adapter image which has
# a variable name of GIOVANNI_ADAPTER_IMAGE you would specify giovanni-adapter (converting to lowercase
# and dash case and dropping _IMAGE. Make sure if the image for the service is not publicly available
# that you have built the docker image locally, otherwise the service will fail to start.
# prefix for the image variable name. For example to deploy the harmony service example image which
# has a variable name of HARMONY_SERVICE_EXAMPLE_IMAGE you would specify harmony-service-example
# (converting to lowercase, converting to dash case, and dropping _IMAGE). Make sure if the image
# for the service is not publicly available that you have built the docker image locally, otherwise
# the service will fail to start.
LOCALLY_DEPLOYED_SERVICES=harmony-service-example

# Local development: Use the following to set the Kubernetes context used by start scripts
Expand Down
35 changes: 23 additions & 12 deletions services/harmony/test/deployment-callback.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ import hookServersStartStop from './helpers/servers';
import { getServiceConfigs } from '../app/models/services';
import { ServiceConfig } from '../app/models/services/base-service';

const serviceName = 'gesdisc/giovanni';
const serviceNewTag = 'harmonyservices/giovanni-adapter:newtag';
const serviceName = 'harmony/service-example';
const serviceNewTag = 'harmonyservices/service-example:newtag';

const callbackMessage = {
deployService: 'giovanni-adapter',
deployService: 'harmony-service-example',
image: serviceNewTag,
serviceQueueUrls: '["harmonyservices/giovanni-adapter:test,https://sqs.us-west-2.amazonaws.com/123456/giovanni-adapter-test-0-sandbox"]',
serviceQueueUrls: '["harmonyservices/harmony-service-example:test,https://sqs.us-west-2.amazonaws.com/123456/harmony-service-example-test-0-sandbox"]',
};

/**
Expand All @@ -22,13 +22,15 @@ const callbackMessage = {
function findImageByName(configs: ServiceConfig<unknown>[], targetName: string): string | undefined {
for (const config of configs) {
if (config.name === targetName) {
// Assuming the first step has the desired image
const firstStep = config.steps[0];
if (firstStep && firstStep.image) {
return firstStep.image;
// Assuming the second step has the desired image
const secondStep = config.steps[1];
if (secondStep && secondStep.image) {
return secondStep.image;
}
}
}


return undefined;
}

Expand All @@ -37,12 +39,12 @@ describe('Deployment callback endpoint', async function () {
let originalImage;
before(function () {
// Save the original process.env
originalImage = process.env.GIOVANNI_ADAPTER_IMAGE;
originalImage = process.env.HARMONY_SERVICE_EXAMPLE_IMAGE;
});

after(function () {
// Restore the original process.env after test
process.env.GIOVANNI_ADAPTER_IMAGE = originalImage;
process.env.HARMONY_SERVICE_EXAMPLE_IMAGE = originalImage;
});

describe('handle callback message', function () {
Expand Down Expand Up @@ -101,8 +103,17 @@ describe('Deployment callback endpoint', async function () {
.set('Content-Type', 'application/json');
});

after(function () {
after(async function () {
delete this.res;
// Set the image back to the original tag to prevent breaking other tests outside this file
// loadServiceConfigs(env.cmrEndpoint);
const originalImageCallback = callbackMessage;
originalImageCallback.image = 'harmonyservices/service-example:latest';
await request(this.backend)
.post('/service/deployment-callback')
.send(originalImageCallback)
.set('cookie-secret', process.env.COOKIE_SECRET)
.set('Content-Type', 'application/json');
});

it('runs the request successfully', async function () {
Expand All @@ -115,7 +126,7 @@ describe('Deployment callback endpoint', async function () {

it('updates the image tag', async function () {
let serviceImage = findImageByName(configs, serviceName);
expect(serviceImage).to.equal('harmonyservices/giovanni-adapter:latest');
expect(serviceImage).to.equal('harmonyservices/service-example:latest');
// get the service config again and verify that it is updated to the new tag
serviceImage = findImageByName(getServiceConfigs(), serviceName);
expect(serviceImage).to.equal(serviceNewTag);
Expand Down
2 changes: 1 addition & 1 deletion services/harmony/test/helpers/servers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export default function hookServersStartStop(opts = { skipEarthdataLogin: true }
this.backend = servers.backend;

stub(env, 'callbackUrlRoot').get(() => `http://127.0.0.1:${servers.backend.address().port}`);
const locallyDeployedServices = 'giovanni-adapter,harmony-service-example,' +
const locallyDeployedServices = 'giovanni-time-series-adapter,harmony-service-example,' +
'harmony-netcdf-to-zarr,var-subsetter,swath-projector,harmony-gdal-adapter,' +
'podaac-concise,sds-maskfill,trajectory-subsetter,podaac-l2-subsetter,harmony-regridder,' +
'hybig,geoloco,stitchee,batchee,hoss,subset-band-name';
Expand Down
2 changes: 1 addition & 1 deletion services/harmony/test/helpers/work-items.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { objectStoreForProtocol } from '../../app/util/object-store';

export const exampleWorkItemProps = {
jobID: '1',
serviceID: 'harmony-services/query-cmr:latest',
serviceID: 'harmony-services/query-cmr:stable',
status: WorkItemStatus.READY,
workflowStepIndex: 0,
} as WorkItemRecord;
Expand Down
2 changes: 1 addition & 1 deletion services/harmony/test/helpers/workflow-steps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const validOperationWithManyVariables = operationWithManyVariables.serial

const exampleProps = {
jobID: '1',
serviceID: 'harmony-services/query-cmr:latest',
serviceID: 'harmony-services/query-cmr:stable',
stepIndex: 0,
workItemCount: 10,
operation: validOperation,
Expand Down
10 changes: 2 additions & 8 deletions services/harmony/test/service-image-tags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { stub } from 'sinon';
const serviceImages = {
'batchee': 'latest',
'geoloco': 'latest',
'giovanni-adapter': 'latest',
'giovanni-time-series-adapter': '1.0.0',
'harmony-gdal-adapter': 'latest',
'harmony-netcdf-to-zarr': 'latest',
'harmony-regridder': 'latest',
Expand Down Expand Up @@ -230,19 +230,13 @@ describe('ecrImageNameToComponents', function () {
describe('Service image endpoint', async function () {
let envStub;
beforeEach(function () {
envStub = stub(env, 'locallyDeployedServices').get(() => 'giovanni-adapter,harmony-service-example,harmony-netcdf-to-zarr,var-subsetter,swath-projector,harmony-gdal-adapter,podaac-concise,sds-maskfill,trajectory-subsetter,podaac-l2-subsetter,harmony-regridder,hybig,geoloco');
envStub = stub(env, 'locallyDeployedServices').get(() => 'harmony-service-example,harmony-netcdf-to-zarr,var-subsetter,swath-projector,harmony-gdal-adapter,podaac-concise,sds-maskfill,trajectory-subsetter,podaac-l2-subsetter,harmony-regridder,hybig,geoloco');
});

afterEach(function () {
envStub.restore();
});

const locallyDeployedServices = 'giovanni-adapter,harmony-service-example,harmony-netcdf-to-zarr,var-subsetter,swath-projector,harmony-gdal-adapter,podaac-concise,sds-maskfill,trajectory-subsetter,podaac-l2-subsetter,harmony-regridder,hybig,geoloco,subset-band-name';

beforeEach(function () {
process.env.LOCALLY_DEPLOYED_SERVICES = locallyDeployedServices;
});

hookServersStartStop({ skipEarthdataLogin: false });

describe('List service images', async function () {
Expand Down
2 changes: 1 addition & 1 deletion services/harmony/test/service-metrics-backends.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ describe('Backend service metrics endpoint', function () {
});

describe('when hitting the service/metrics endpoint with an existing serviceID', async function () {
const serviceID = 'harmony/query-cmr:latest';
const serviceID = 'harmony/query-cmr:stable';

// The number of work items that should be returned for each of the job statuses
const testParametersList = [
Expand Down

0 comments on commit f29d16c

Please sign in to comment.