-
Notifications
You must be signed in to change notification settings - Fork 21
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
Make a clean interface for jobs #939
Open
javiermtorres
wants to merge
13
commits into
main
Choose a base branch
from
javiermtorres/issue-413-separate-interfaces
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+251
−148
Open
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
af2f6c5
Initial job interface, refactor in workflow status
javiermtorres 62ba683
Review rework
javiermtorres c9bd64f
Restore DS model url after merge
javiermtorres d4f5764
Fix merge issues
javiermtorres 2650889
Review rework
javiermtorres 29dfdb9
Align with main mlflow implementation
javiermtorres f1cff88
Merge branch 'main' into javiermtorres/issue-413-job-type-interface
javiermtorres 2994468
Initial job interface, refactor in workflow status
javiermtorres 9dbf137
Review rework
javiermtorres 771901f
Attempt to make backend code available from the job implementation
javiermtorres 9983019
Attempt to make backend code available from the job implementation
javiermtorres eeedea9
Tweak paths to allow job importing in backend
javiermtorres fc162ce
Align with main
javiermtorres File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
from abc import ABC, abstractmethod | ||
from uuid import UUID | ||
|
||
from lumigator_schemas.jobs import JobCreate | ||
from pydantic import BaseModel | ||
|
||
|
||
class JobDefinition(ABC): | ||
"""Abstract base class for jobs. | ||
|
||
Attributes: | ||
---------- | ||
command : str | ||
The command to execute the job. | ||
pip_reqs : str, optional | ||
Path to a requirements file specifying dependencies (default: None). | ||
work_dir : str, optional | ||
Working directory for the job (default: None). | ||
config_model : BaseModel | ||
Pydantic model representing job-specific configuration. | ||
|
||
""" | ||
|
||
command: str | ||
pip_reqs: str | None | ||
work_dir: str | None | ||
config_model: BaseModel | ||
type: str | ||
|
||
# This should end up not being necessary, since we'd expose the whole job config | ||
@abstractmethod | ||
def generate_config( | ||
self, request: JobCreate, record_id: UUID, dataset_path: str, storage_path: str, type: str | ||
) -> BaseModel: | ||
"""Generates | ||
|
||
Parameters | ||
---------- | ||
request : JobCreate | ||
Non-job-specific parameters for job creation | ||
record_id : UUID | ||
Job ID assigned to the job | ||
dataset_path : str | ||
S3 path for the input dataset | ||
storage_path : str | ||
S3 where the backend will store the results from the job | ||
|
||
Returns: | ||
------- | ||
generate_config : BaseModel | ||
A job-specific pydantic model that will be sent to the Ray job instance | ||
""" | ||
pass | ||
|
||
@abstractmethod | ||
def store_as_dataset(self) -> bool: | ||
"""Returns: | ||
------- | ||
store_as_dataset : bool | ||
Whether the results should be stored in an S3 path | ||
""" | ||
pass | ||
|
||
def __init__(self, command, pip_reqs, work_dir, config_model, type): | ||
self.command = command | ||
self.pip_reqs = pip_reqs | ||
self.work_dir = work_dir | ||
self.config_model = config_model | ||
self.type = type |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like this should go into the dockerfile? This is required for the thing to work
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like hard coding these paths into the docker file. We may need more flexibility. Let's talk about it on Monday.