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

unstract worker interface #272

Closed
wants to merge 2 commits into from
Closed

Conversation

athul-rs
Copy link
Contributor

What

Why

How

Database Migrations

Env Config

Relevant Docs

Related Issues or PRs

Dependencies Versions

Notes on Testing

Screenshots

Checklist

I have read and understood the Contribution Guidelines.

@athul-rs athul-rs changed the title Initial commit for interface Initial commit for docker interface Apr 19, 2024
@athul-rs athul-rs changed the title Initial commit for docker interface Initial commit for unstract worker interface Apr 19, 2024
@athul-rs athul-rs changed the title Initial commit for unstract worker interface unstract worker interface Apr 19, 2024
Copy link

sonarcloud bot commented Apr 19, 2024

Quality Gate Failed Quality Gate failed

Failed conditions
73.2% Duplication on New Code (required ≤ 3%)

See analysis details on SonarCloud

Copy link
Contributor

Choose a reason for hiding this comment

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

We don't need to add all the classes from docker class as an method here. Some of these methods won't make any sense in the context of k8s

Comment on lines +9 to +15
@abstractmethod
def _get_image(self) -> str:
pass

@abstractmethod
def _image_exists(self, image_name_with_tag: str) -> bool:
pass
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think these 2 needs to be part of interface. This is only required in docker_worker

Comment on lines +17 to +19
@abstractmethod
def normalize_container_name(self, name: str) -> str:
pass
Copy link
Contributor

Choose a reason for hiding this comment

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

This will be common for both k8s and docker I believe. So instead of making it an abstract class we could implement it here itself.

Comment on lines +26 to +39
def get_valid_log_message(self, log_line: str):
pass

@abstractmethod
def process_log_message(self, log_line: str, channel):
pass

@abstractmethod
def is_valid_log_type(self, log_type: str) -> bool:
pass

@abstractmethod
def get_log_type(self, log_dict: dict) -> str:
pass
Copy link
Contributor

Choose a reason for hiding this comment

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

All these 4 methods should be common to both k8s and docker. This is our own logics. So please add implementation here instead of making this an abstract method.

Comment on lines +41 to +55
@abstractmethod
def get_spec(self):
pass

@abstractmethod
def get_properties(self):
pass

@abstractmethod
def get_icon(self):
pass

@abstractmethod
def get_variables(self):
pass
Copy link
Contributor

Choose a reason for hiding this comment

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

@athul-rs I think this can also be common for both workers by making sure self.client.container.run is present in k8s implementation also. Or we can pass container object as an input to these methods. We might need to create an interface for this though. Or we could use the docker container datatype itself

@ritwik-g
Copy link
Contributor

@athul-rs I will be taking this up as well. Closing this PR

@ritwik-g ritwik-g closed this May 30, 2024
@ritwik-g ritwik-g deleted the feat/unstract-worker-interface branch May 30, 2024 08:12
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.

None yet

2 participants