Skip to content

feat: add job and task creation#6

Merged
asafMasa merged 4 commits into
masterfrom
addJobTaskCreation
Aug 24, 2021
Merged

feat: add job and task creation#6
asafMasa merged 4 commits into
masterfrom
addJobTaskCreation

Conversation

@asafMasa

Copy link
Copy Markdown
Contributor
Question Answer
New feature

Comment thread src/jobManagerClient.ts Outdated
}

public async updateTask(jobId: string, taskId: string, payload: IUpdateTaskRequestPayload): Promise<void> {
public async createTask(jobId: string, payload: IUpdateTaskBody): Promise<void> {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rename to enqueue

Comment thread src/jobManagerClient.ts Outdated
const createJobUrl = `/jobs`;
await this.post(createJobUrl, payload);
} catch (err) {
this.logger.error(`failed to create job`);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add data to log.
what job?

Comment thread src/jobManagerClient.ts Outdated
const logFormat = `jobId=${jobId}, taskId=${taskId}`;
try {
this.logger.info(`get task ${logFormat}`);
this.logger.info(`${logFormat} get task`);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make logs more readable

Comment thread src/jobManagerClient.ts Outdated
return task;
} catch (err) {
this.logger.error(`failed to get task ${logFormat}`);
this.logger.error(`${logFormat} failed to get task`);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make logs more readable

Comment thread src/jobManagerClient.ts Outdated
const tasks = await this.get<ITaskResponse[]>(getTaskUrl);
return tasks;
} catch (err) {
this.logger.error(`${logFormat} failed to get tasks`);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make logs more readable

Comment thread src/jobManagerClient.ts Outdated
return task;
} catch (err) {
this.logger.error(`failed to get task ${logFormat}`);
this.logger.error(`[JobManagerClient][getTask] jobId=${jobId}, taskId=${taskId} failed to get task`);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add error message

Comment thread src/jobManagerClient.ts Outdated
const tasks = await this.get<ITaskResponse[]>(getTaskUrl);
return tasks;
} catch (err) {
this.logger.error(`[JobManagerClient][getTasksForJob] jobId=${jobId} failed`);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add error message

Comment thread src/jobManagerClient.ts Outdated
return job;
} catch {
this.logger.error(`failed to get job data for job: ${jobId}`);
this.logger.error(`[JobManagerClient][getJob] jobId=${jobId} failed`);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add error message

Comment thread src/jobManagerClient.ts Outdated
return null;
} else {
this.logger.error(`failed to consume ${logFormat}`);
this.logger.error(`[JobManagerClient][consume] jobType=${this.jobType}, taskType=${this.taskType}, failed to consume`);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add error message

Comment thread src/jobManagerClient.ts Outdated
const createTaskUrl = `/jobs/${jobId}/tasks`;
await this.post(createTaskUrl, payload);
} catch (err) {
this.logger.error(`[JobManagerClient][enqueueTask] jobId=${jobId}, payload=${JSON.stringify(payload)} failed`);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add error message

Comment thread src/jobManagerClient.ts Outdated
const createJobUrl = `/jobs`;
await this.post(createJobUrl, payload);
} catch (err) {
this.logger.error(`[JobManagerClient][createJob] payload=${JSON.stringify(payload)} failed`);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add error message

Comment thread src/jobManagerClient.ts Outdated
await this.put(updateTaskUrl, payload);
} catch (err) {
this.logger.error(`failed to update task ${logFormat}`);
this.logger.error(`[JobManagerClient][updateTask] jobId=${jobId}, taskId=${taskId}, payload=${JSON.stringify(payload)} failed`);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add error message

Comment thread src/jobManagerClient.ts Outdated
await this.put(updateJobUrl, payload);
} catch (err) {
this.logger.error(`failed to update job Id=${jobId}`);
this.logger.error(`[JobManagerClient][updateJob] jobId=${jobId}, payload=${JSON.stringify(payload)} failed`);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add error message

@asafMasa asafMasa merged commit 13ac567 into master Aug 24, 2021
@asafMasa asafMasa deleted the addJobTaskCreation branch August 24, 2021 07:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants