Skip to content

[PROD] TaaS Release 1.0 #613

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

Merged
merged 27 commits into from
Jan 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
76c64a5
Add the performance testing code
codejamtc Dec 22, 2020
accc73a
Update README.md
codejamtc Dec 22, 2020
c05fc86
Update config.yml
codejamtc Dec 22, 2020
ff43cb4
Update config.yml
codejamtc Dec 23, 2020
ca831c0
Merge pull request #606 from topcoder-platform/hotfix/milestone-delete
RishiRajSahu Dec 29, 2020
7d71274
Update config.yml
codejamtc Jan 6, 2021
a8567db
Merge branch 'develop' into connect-performance-testing
codejamtc Jan 6, 2021
3009b3d
Update config.yml
codejamtc Jan 6, 2021
a30c703
Update JMeter_README.md
codejamtc Jan 6, 2021
ac6312d
Update config.yml
codejamtc Jan 6, 2021
bf6f03d
Revert "chore: temporary disable jobs creation"
maxceem Jan 6, 2021
8a3544a
feat: updated TaaS Job creation data
maxceem Jan 7, 2021
f94ae6a
fix: creating taas jobs
maxceem Jan 7, 2021
4ff4dac
fix: rename field of TaaS Jobs
maxceem Jan 7, 2021
6b8813c
Merge pull request #603 from topcoder-platform/connect-performance-te…
RishiRajSahu Jan 8, 2021
f6177a1
fix: use "weekly" rateType for create jobs
maxceem Jan 11, 2021
b2f1a43
feat: don't set unknown fields for Jobs
maxceem Jan 12, 2021
2581421
Add unit test to the circleci conf file
codejamtc Jan 12, 2021
c0599ab
Update config.yml
codejamtc Jan 12, 2021
743ef07
Update config.yml
codejamtc Jan 12, 2021
41c04d3
Update config.yml
codejamtc Jan 12, 2021
cbbc13f
Update config.yml
codejamtc Jan 12, 2021
2d2ab63
fix: lint
maxceem Jan 12, 2021
e66d88d
Merge branch 'develop' into connect-performance-testing
codejamtc Jan 12, 2021
8c062b8
Update config.yml
codejamtc Jan 12, 2021
a2ffa2c
Merge pull request #612 from topcoder-platform/connect-performance-te…
maxceem Jan 12, 2021
8f0b0ee
Merge branch 'master' into feature/taas-jobs-2
maxceem Jan 28, 2021
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 .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ workflows:
- UnitTests
filters:
branches:
only: ['develop']
only: ['develop', 'connect-performance-testing']
- deployProd:
context : org-global
requires:
Expand Down
75 changes: 34 additions & 41 deletions src/events/projects/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import Joi from 'joi';
import Promise from 'bluebird';
import config from 'config';
import axios from 'axios';
import moment from 'moment';
import util from '../../util';
import models from '../../models';
import { createPhaseTopic } from '../projectPhases';
Expand Down Expand Up @@ -175,7 +174,6 @@ async function projectCreatedKafkaHandler(app, topic, payload) {
if (result.error) {
throw new Error(result.error);
}

const project = payload;

if (project.phases && project.phases.length > 0) {
Expand All @@ -187,46 +185,41 @@ async function projectCreatedKafkaHandler(app, topic, payload) {
await Promise.all(topicPromises);
app.logger.debug('Topics for phases are successfully created.');
}
// TODO: temporary disable this feature, until we release TaaS APP
if (false === true && project.type === 'talent-as-a-service') {
const specialists = _.get(project, 'details.taasDefinition.specialists');
if (!specialists || !specialists.length) {
app.logger.debug(`no specialists found in the project ${project.id}`);
return;
try {
if (project.type === 'talent-as-a-service') {
const jobs = _.get(project, 'details.taasDefinition.taasJobs');
if (!jobs || !jobs.length) {
app.logger.debug(`no jobs found in the project id: ${project.id}`);
return;
}
app.logger.debug(`${jobs.length} jobs found in the project id: ${project.id}`);
await Promise.all(
_.map(
jobs,
(job) => {
// make sure that skills would be unique in the list and only include ones with 'skillId' (actually they all suppose to be with skillId)
const skills = _.chain(job.skills).map('skillId').uniq().compact()
.value();
return createTaasJob({
projectId: project.id,
title: job.title,
description: job.description,
skills,
numPositions: Number(job.people),
resourceType: _.get(job, 'role.value', ''),
rateType: 'weekly', // hardcode for now
workload: _.get(job, 'workLoad.title', '').toLowerCase(),
}).then((createdJob) => {
app.logger.debug(`jobId: ${createdJob.id} job created with title "${createdJob.title}"`);
}).catch((err) => {
app.logger.error(`Unable to create job with title "${job.title}": ${err.message}`);
});
},
),
);
}
const targetSpecialists = _.filter(specialists, specialist => Number(specialist.people) > 0); // must be at least one people
await Promise.all(
_.map(
targetSpecialists,
(specialist) => {
const startDate = new Date();
const endDate = moment(startDate).add(Number(specialist.duration), 'M'); // the unit of duration is month
// make sure that skills would be unique in the list
const skills = _.uniq(
// use both, required and additional skills for jobs
specialist.skills.concat(specialist.additionalSkills)
// only include skills with `skillId` and ignore custom skills in jobs
.filter(skill => skill.skillId).map(skill => skill.skillId),
);
return createTaasJob({
projectId: project.id,
externalId: '0', // hardcode for now
description: specialist.roleTitle,
startDate,
endDate,
skills,
numPositions: Number(specialist.people),
resourceType: specialist.role,
rateType: 'hourly', // hardcode for now
workload: _.get(specialist, 'workLoad.title', '').toLowerCase(),
}).then((job) => {
app.logger.debug(`jobId: ${job.id} job created for roleTitle ${specialist.roleTitle}`);
}).catch((err) => {
app.logger.error(`Unable to create job for ${specialist.roleTitle}: ${err.message}`);
});
},
),
);
} catch (error) {
app.logger.error(`Error while creating TaaS jobs: ${error}`);
}
}

Expand Down