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

core-service & ml-workers integration #12

Closed
wants to merge 11 commits into from
Closed

Conversation

dcgoss
Copy link
Member

@dcgoss dcgoss commented Jun 28, 2017

Motivation

In order to get to MVP, task-service must integrate with core-service and ml-workers.
This involves:

  • automatically creating task-defs from task creation requests
  • providing endpoints where an ml-worker can "complete", "release", and "fail" a task

API changes

Functional Tests

  • Added test for creating a task with the name of a nonexistent task-def to ensure the task-def is created in the same request.
  • Refactored task queue tests to use the complete/fail/release endpoints.

Instead of tracking task priority with words like “high”, “low”, etc,
this commit changes task priorities to be tracked with positive
integers. Lower integers are higher priority. Why? Simplicity and
performance. It is much easier for a database to sort numbers than to
convert words to numbers and then sort. It also simplifies the
“vocabulary”, meaning the specific word used is not relevant - only the
magnitude of number.
For now, I believe it is acceptable for the task-service to
automatically create a task-def based off of a task creation request if
a task-def of the specified name doesn’t already exist.
This also helps with ensuring the core-service tests succeed in their
current form, as they do not create a task-def prior to creating a task.
Including the nested data of a task-def in the data of task create
request will create both the task-def and the task simultaneously. If
the task-def already exists, a new one is not created and the old one
is used.
This endpoint is called by ml-worker when a task is completed and the
completed notebook has been uploaded to core-service. The endpoint
updates the status, completed_at, locked_at, and worker_id attributes
of the task.
I prefer the design pattern where a request hits an endpoint for a
specific task and the server does the updating, rather than the client
doing the updating and hitting a general purpose “update” endpoint
where the client can update any value. I followed this pattern in
532d1f8 and continue it here by adding
in an endpoint for “failing” a task. I also updated the queue tests as
they used to hit the general purpose “update” endpoint - they now hit
the specific complete/fail/release/etc. endpoints.
@dcgoss dcgoss changed the title Nested task-def creation from task creation + integer priorities core-service & ml-workers integration Jul 6, 2017
Ported from core-service
Added CircleCI integration
A 204 status code delivers no data in the response. A 200 allows for
data to be returned.
commands:
- chmod +x ecr_push.sh ecs_deploy.sh
- ./ecr_push.sh
- ./ecs_deploy.sh -t 180 -c $AWS_CLUSTER_NAME -n $AWS_SERVICE_NAME -i $AWS_ECR_ENDPOINT.dkr.ecr.us-east-1.amazonaws.com/cognoma-task-service:$CIRCLE_SHA1
Copy link
Member

Choose a reason for hiding this comment

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

I recommend long args whenever you're writing shell scrips (i.e. not just typing in command line), since they're more explicit and readable. Also consider splitting long command onto multiple lines, which will help with git diff later.

@@ -0,0 +1,544 @@
#!/usr/bin/env bash
# source: https://github.com/silinternational/ecs-deploy
Copy link
Member

Choose a reason for hiding this comment

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

You should probably include the MIT License text in this file from https://github.com/silinternational/ecs-deploy/blob/develop/LICENSE.

END,
run_at
LIMIT %s
ORDER BY priority, run_at
Copy link
Member

Choose a reason for hiding this comment

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

Yep ints make much more sense!

@dcgoss
Copy link
Member Author

dcgoss commented Jul 12, 2017

Closing due to cognoma/core-service#74

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.

2 participants