-
Notifications
You must be signed in to change notification settings - Fork 17
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
This PR addresses issues found in https://github.com/valory-xyz/open-autonomy/pull/1701 #518
Changes from 2 commits
5e12b4d
39acbf4
b7bea86
6ab74a5
ec5d419
16c6cf0
7688d89
4270ca9
6fedfca
772df27
0a9f855
2c94de2
7427cd5
040cda5
49181bc
b77ab2d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -324,29 +324,28 @@ def download( | |
:return: downloaded path | ||
""" | ||
|
||
def move_to_target_dir(download_tmp_path) -> str: | ||
def move_to_target_dir(download_tmp_path: Path) -> str: | ||
"""Move downloaded content to target directory""" | ||
if download_tmp_path.is_file(): | ||
# file is ok! | ||
# Downloaded object is a file and can be moved easily | ||
shutil.move(str(download_tmp_path), str(target_dir)) | ||
return str(target_dir) | ||
|
||
if fix_path: | ||
# identify name of package | ||
paths = list(download_tmp_path.glob("*")) | ||
assumption_is_valid = len(paths) == 1 and paths[0].is_dir() | ||
if not assumption_is_valid: # pragma: no cover | ||
error_msg = f"Expected a single directory, found: {paths}" | ||
raise DownloadError(error_msg) | ||
Comment on lines
-339
to
-340
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The downloaded object can be either a file or a directory, which can be wrapped under a wrapper node. So this gives 4 possibilities for a downloaded object. A file, file wrapped, dir and dir wrapped. We need a better mechanism to detect these 4 and filter out aea component packages. #519 |
||
package_path = paths.pop() | ||
if len(paths) == 1: | ||
(package_path,) = paths | ||
else: | ||
package_path = download_tmp_path | ||
Comment on lines
+337
to
+340
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Continuing from #518 (comment), this will fix the issue but we need to make this method more robust in terms of working with different types of download objects There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @angrybayblade @Karrenbelt
and doesnt matter what is actually inside. wrapped single file is a directory actually. with one file inside and it's filename quite simple logic. content related operations should be done on the upper level. my conclusion: make ipfstool as simple as possible (download dir, file, retries) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please open an issue for this so when we're working #519 we work on this afterwards |
||
|
||
# move content of directory with hashid to target dir | ||
shutil.move(str(package_path), str(target_dir)) | ||
return str(target_dir / package_path.name) | ||
return str(Path(target_dir, package_path.name)) | ||
|
||
# move directory with hash id to target dir | ||
shutil.move(str(download_tmp_path), str(target_dir)) | ||
return str(target_dir / download_tmp_path.name) | ||
return str(Path(target_dir, download_tmp_path.name)) | ||
|
||
target_dir = Path(target_dir) | ||
target_dir.mkdir(exist_ok=True, parents=True) | ||
|
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.
This addresses https://github.com/valory-xyz/open-autonomy/actions/runs/3819359169/jobs/6496927078#step:7:9939 failure. We load agent packages in same manner as we load the component packages before running the tests
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.
Where is the test for this branch? Why was it not required before?
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.
We did not load the agent package before because there was no code part of the agent component similar to other components so we could run the test without loading the agent package.
When I was recreating this issue locally I found out that this issue only occurs in one specific condition that is if you run the tests in a tox env and all packages available. When I ran tests for agents only by modifying the test command they ran without any issue and when I ran the same command we run in the tox env normally they ran without any issues as well.
So my assumption is since we're loading the components other than the agents the references in the
sys.modules
does not contain references to thepackages.author.components
and not thepackages.author.agents
which is the reason why the pytest was throwing import error.Now this did not happen before, this started happening after the release of
1.27.0
and we haven't changed anything in the test command except for the #504 which does not look like could've caused the issue so this is still a mystery for me why this started happening suddenly