-
Notifications
You must be signed in to change notification settings - Fork 10
AAP-47753: Implement run_pattern_task() for PatternViewSet #15
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
AAP-47753: Implement run_pattern_task() for PatternViewSet #15
Conversation
c67dc6e
to
35c0d3c
Compare
0f43195
to
c8fd9b9
Compare
|
b3d8028
to
bd95fbf
Compare
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.
The documentation needs to be updated to include the new required and optional env variables used to connect to an AAP/aap-dev instance.
bdfb8dc
to
4cc39a9
Compare
Signed-off-by: Alina Buzachis <[email protected]>
Signed-off-by: Alina Buzachis <[email protected]>
Signed-off-by: Alina Buzachis <[email protected]>
Signed-off-by: Alina Buzachis <[email protected]>
Signed-off-by: Alina Buzachis <[email protected]>
Signed-off-by: Alina Buzachis <[email protected]>
Signed-off-by: Alina Buzachis <[email protected]>
Signed-off-by: Alina Buzachis <[email protected]>
Signed-off-by: Alina Buzachis <[email protected]>
3c9aa88
to
3dafb3f
Compare
pattern_service/settings/aap.py
Outdated
) | ||
|
||
|
||
def _validate_url(url: str) -> str: |
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.
Why do we have this file here? It seems that it is used to validate the settings.AAP_URL
, which can be part of a utils
directory and called in the ready()
function of the App config
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.
@abikouo Can you please let me know if the changes meet your expectations? Thanks.
core/utils.py
Outdated
from typing import Iterator | ||
from urllib.parse import urljoin | ||
|
||
from pattern_service.settings.aap import AAP_URL |
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.
You should import the django.conf.settings
instead
core/controller_client.py
Outdated
from requests import Session | ||
from requests.auth import HTTPBasicAuth | ||
|
||
from pattern_service.settings.aap import AAP_PASSWORD |
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.
The settings are directly available as django.conf import settings
Signed-off-by: Alina Buzachis <[email protected]>
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.
Looks good overall, but still not getting the point why we need the settings/aap.py
file
The idea behind this file was to manage the authentication credentials for AAP needed to download the collection from the hub instance. I'm open to suggestions, so feel free to propose something else. |
I understand the point, but currently, the file |
Signed-off-by: Alina Buzachis <[email protected]>
Ok, right! I remove the |
core/task_runner.py
Outdated
Args: | ||
pattern_id (int): The ID of the pattern to process. | ||
task_id (int): The ID of the task.. |
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.
task_id (int): The ID of the task.. | |
task_id (int): The ID of the task. |
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.
Just one super minor edit
Signed-off-by: Alina Buzachis <[email protected]>
Signed-off-by: Alina Buzachis <[email protected]>
bfd75b6
to
70acf24
Compare
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.
Just a couple of minor comments, otherwise this LGTM.
core/task_runner.py
Outdated
logger.error(f"Could not find pattern definition for task {task_id}") | ||
task.mark_failed({"error": "Pattern definition not found."}) | ||
except Exception as e: | ||
logger.error(f"Task {task_id} failed: {e}") |
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.
Can we use logger.exception to include the full traceback in logs for debugging?
except Exception:
error_message = "An unexpected error occurred."
logger.exception(f"Task {task_id} failed unexpectedly.")
task.mark_failed({"error": error_message})
core/utils/controller/helpers.py
Outdated
temporary directory. | ||
Args: | ||
collection: The name of the collection (e.g., 'my_namespace.my_collection'). |
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.
collection: The name of the collection (e.g., 'my_namespace.my_collection'). | |
collection_name: The name of the collection (e.g., 'my_namespace.my_collection'). |
Signed-off-by: Alina Buzachis <[email protected]>
4ed895d
to
40e4434
Compare
Signed-off-by: Alina Buzachis <[email protected]>
Signed-off-by: Alina Buzachis <[email protected]>
Signed-off-by: Alina Buzachis <[email protected]>
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.
Just a few more small changes.
Signed-off-by: Alina Buzachis <[email protected]>
052b727
to
bed3404
Compare
https://issues.redhat.com/browse/AAP-47753