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

updates to v2.1 #1462

Merged
merged 4 commits into from
Dec 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
@@ -1 +1 @@
hkube-python-wrapper==2.2.1
hkube-python-wrapper==2.2.2
1 change: 1 addition & 0 deletions core/algorithm-builder/tests/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ describe('Test', function () {
expect(build.progress).to.equal(100);
});
it('nodejs: build', async function () {
this.timeout(20000)
const env = 'nodejs';
const buildId = uuid();
await runBuild({ buildId, env });
Expand Down
2 changes: 1 addition & 1 deletion core/algorithm-operator/lib/jobs/jobCreator.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const createDriverJobSpec = ({ resourceRequests, image, inputEnv, clusterOptions
spec = applyName(spec, CONTAINERS.PIPELINE_DRIVER);
spec = applyPipelineDriverImage(spec, image);
spec = applyEnvToContainer(spec, CONTAINERS.PIPELINE_DRIVER, inputEnv);
if (settings.applyResources) {
if (settings.applyResourceLimits) {
spec = applyPipelineDriverResourceRequests(spec, resourceRequests);
}
spec = applyJaeger(spec, CONTAINERS.PIPELINE_DRIVER, options);
Expand Down
7 changes: 5 additions & 2 deletions core/algorithm-operator/tests/pipeline-drivers.js
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,10 @@ describe('bootstrap', () => {
});
describe('createDriverJobSpec', () => {
beforeEach(() => {
globalSettings.applyResources = false;
globalSettings.applyResourceLimits = false;
});
after(() => {
globalSettings.applyResourceLimits = false;
});
it('should throw if no image name', () => {
expect(() => createDriverJobSpec({ options })).to.throw('Unable to create job spec. image is required');
Expand All @@ -358,7 +361,7 @@ describe('bootstrap', () => {
expect(res.metadata.name).to.include(CONTAINERS.PIPELINE_DRIVER);
});
it('should apply resources', () => {
globalSettings.applyResources = true;
globalSettings.applyResourceLimits = true;
const res = createDriverJobSpec({
...{ options },
image: 'myImage1',
Expand Down
10 changes: 5 additions & 5 deletions core/task-executor/lib/jobs/jobCreator.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,11 +187,11 @@ const applyDevMode = (inputSpec, { algorithmOptions = {}, algorithmName, cluster
return spec;
};

const applyDataSourcesVolumes = (inputSpec) => {
const applyDataSourcesVolumes = (inputSpec, clusterOptions) => {
let spec = clonedeep(inputSpec);
// if (!clusterOptions.dataSourcesEnabled) {
// return spec;
// }
if (!clusterOptions?.datasourcesServiceEnabled) {
return spec;
}
spec = applyVolumeMounts(spec, CONTAINERS.ALGORITHM, {
name: 'datasources-storage',
mountPath: '/hkube/datasources-storage'
Expand Down Expand Up @@ -362,7 +362,7 @@ const createJobSpec = ({ kind, algorithmName, resourceRequests, workerImage, alg
spec = applyJaeger(spec, CONTAINERS.WORKER, options);
spec = applyJaeger(spec, CONTAINERS.ALGORITHM, options);
spec = applyDevMode(spec, { options, algorithmOptions, clusterOptions, algorithmName });
spec = applyDataSourcesVolumes(spec);
spec = applyDataSourcesVolumes(spec, clusterOptions);
spec = applyMounts(spec, mounts);
spec = applyImagePullSecret(spec, clusterOptions?.imagePullSecretName);

Expand Down
22 changes: 13 additions & 9 deletions core/task-executor/tests/jobCreatorTests.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ describe('jobCreator', () => {
expect(() => createJobSpec({ algorithmImage: 'myImage1', options })).to.throw('Unable to create job spec. algorithmName is required');
});
it('should apply all required properties', () => {
const res = createJobSpec({ algorithmImage: 'myImage1', algorithmName: 'myalgo1', options });
const res = createJobSpec({ algorithmImage: 'myImage1', algorithmName: 'myalgo1', options, clusterOptions: { datasourcesServiceEnabled: true } });
expect(res).to.nested.include({ 'spec.template.spec.containers[1].image': 'myImage1' });
expect(res).to.nested.include({ 'metadata.labels.algorithm-name': 'myalgo1' });
expect(res).to.nested.include({ 'spec.template.spec.containers[0].image': 'hkube/worker:latest' });
Expand Down Expand Up @@ -347,13 +347,17 @@ describe('jobCreator', () => {
);
});
it('should apply 0 mounts', () => {
const res = createJobSpec({ algorithmImage: 'myImage1', algorithmName: 'myalgo1', workerImage: 'workerImage2', options, mounts: [] });
const res = createJobSpec({ algorithmImage: 'myImage1', algorithmName: 'myalgo1', workerImage: 'workerImage2', options, mounts: [], clusterOptions: { datasourcesServiceEnabled: true } });
expect(res.spec.template.spec.volumes).to.have.length(4)
});
it('should apply no mounts', () => {
const res = createJobSpec({ algorithmImage: 'myImage1', algorithmName: 'myalgo1', workerImage: 'workerImage2', options });
const res = createJobSpec({ algorithmImage: 'myImage1', algorithmName: 'myalgo1', workerImage: 'workerImage2', options, clusterOptions: { datasourcesServiceEnabled: true } });
expect(res.spec.template.spec.volumes).to.have.length(4)
});
it('should not apply datasources pvc if disabled', () => {
const res = createJobSpec({ algorithmImage: 'myImage1', algorithmName: 'myalgo1', workerImage: 'workerImage2', options, clusterOptions: { datasourcesServiceEnabled: false } });
expect(res.spec.template.spec.volumes).to.have.length(3)
});
it('should apply opengl params', () => {
const res = createJobSpec({ algorithmImage: 'myImage1', algorithmName: 'myalgo1', workerImage: 'workerImage2', options, algorithmOptions: { opengl: true } });
expect(res.spec.template.spec.containers[1].env).to.deep.include({ name: 'DISPLAY', value: ':0' })
Expand Down Expand Up @@ -422,19 +426,19 @@ describe('jobCreator', () => {
],
environments: [
{
name: "env1",
value: "val1"
name: "env1",
value: "val1"
},
{
name: "env2",
value: "val2"
name: "env2",
value: "val2"
}
]
]

}]
})
after(() => {
globalSettings.sidecars=[]
globalSettings.sidecars = []
});
it('should not apply sidecar if not enabled', () => {
const res = createJobSpec({
Expand Down