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

Added the policy es_model helps to unique policy data #747

Merged
merged 1 commit into from
Jun 24, 2024

Conversation

athiruma
Copy link
Collaborator

Type of change

Note: Fill x in []

  • bug
  • enhancement
  • documentation
  • dependencies

Description

Creating PolicyEsModal helps to create the unique data to upload to the elastic_search

For security reasons, all pull requests need to be approved first before running any automated CI

@athiruma athiruma added dependencies Pull requests that update a dependency file ok-to-test PR ok to test labels Mar 27, 2024
@athiruma athiruma requested a review from ebattat March 27, 2024 07:40
@athiruma athiruma self-assigned this Mar 27, 2024
action_days: str
skip_policy: str
cost: float = ''
savings: float = ''
Copy link
Collaborator

Choose a reason for hiding this comment

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

yearly_saving

@ebattat
Copy link
Collaborator

ebattat commented Apr 26, 2024

@athiruma there is conflict, pls fix it

@athiruma athiruma marked this pull request as draft May 30, 2024 01:32
@athiruma athiruma marked this pull request as ready for review June 11, 2024 04:29
running_days: int = ''
create_date: str = ''

def __post_init__(self):
Copy link
Collaborator

Choose a reason for hiding this comment

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

What the purpose of post init, why not to use init ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It helps to init the variables after initialization of variables in the init method.

@staticmethod
def convert_to_title_case(snake_case: str):
"""
This method convert lower case to title case
Copy link
Collaborator

Choose a reason for hiding this comment

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

converts


@dataclass
class PolicyEsMetaData(dict):

Copy link
Collaborator

Choose a reason for hiding this comment

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

can u add the class purpose ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ok


def __post_init__(self):
"""
This method initialize the IndexId
Copy link
Collaborator

Choose a reason for hiding this comment

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

initializes

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ok

@@ -130,3 +131,17 @@ def get_start_and_end_datetime(days: int) -> [datetime, datetime]:
end_date = datetime.utcnow()
start_date = end_date - timedelta(days=days)
return start_date, end_date

@staticmethod
def convert_to_title_case(snake_case: str):
Copy link
Collaborator

Choose a reason for hiding this comment

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

if this method is only for testing purpose, I think it should be under test directory

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No, it helps to convert lower case to title case, that is being push to the ElasticSearch

Copy link
Collaborator

Choose a reason for hiding this comment

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

@athiruma, WDYT ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It's not a testing method.

@athiruma
Copy link
Collaborator Author

I have resolved the comments.



@dataclass
class PolicyEsData(dict):
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

change PolicyEsMetaData

public_cloud: str
action_days: str
skip_policy: str
cost: float = ''
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

cost_unit

action_days: str
skip_policy: str
cost: float = ''
savings: float = ''
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yearly_cost_savings

running_days: int = ''
create_date: str = ''

def __post_init__(self):
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It helps to init the variables after initialization of variables in the init method.


@dataclass
class PolicyEsMetaData(dict):

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ok


def __post_init__(self):
"""
This method initialize the IndexId
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ok

@@ -130,3 +131,17 @@ def get_start_and_end_datetime(days: int) -> [datetime, datetime]:
end_date = datetime.utcnow()
start_date = end_date - timedelta(days=days)
return start_date, end_date

@staticmethod
def convert_to_title_case(snake_case: str):
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No, it helps to convert lower case to title case, that is being push to the ElasticSearch

@@ -130,3 +131,17 @@ def get_start_and_end_datetime(days: int) -> [datetime, datetime]:
end_date = datetime.utcnow()
start_date = end_date - timedelta(days=days)
return start_date, end_date

@staticmethod
def convert_to_title_case(snake_case: str):
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It's not a testing method.

Copy link
Collaborator

@ebattat ebattat left a comment

Choose a reason for hiding this comment

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

/LGTM

@ebattat ebattat merged commit 8865708 into redhat-performance:main Jun 24, 2024
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file ok-to-test PR ok to test
Projects
Development

Successfully merging this pull request may close these issues.

2 participants