-
Notifications
You must be signed in to change notification settings - Fork 4
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
#1140 - List Files #1626
base: dev
Are you sure you want to change the base?
#1140 - List Files #1626
Conversation
#1652 - COMPS Asset Collection return
Update old comps download command
@shchen-idmod, @ZDu-IDM this is core functionality to mainly replace the download command. It adds new APIs to the platform to allow fetching files. This should be useful in many other situations as well since we get nice pythonic code to iterate files like this for asset in experiment.list_assets(filters=["*.txt"])
asset.download_to_path(output_path)
for simulation in experiment.simulations:
for asset in simulation.list_files(filters=["*.txt"])
asset.download_to_path(output_path) and files = experiment.list_children(filters=[".txt"]
for simulation, files in files.items():
for file in files:
file.download_to_path(f"{experiment.id}/{simulation.id}/") Another thing we could do is have users have alternates to analyzers. For example # get csvs
files = experiment.list_children(filters=[".csv"]
content = []
for simulation, files in files.items():
for file in files:
#create data frames(select data)
content.append(pd.read_csv(file.download_stream().decode('utf-8')))
# aggregate into one file
df = pd.concat(content)
df.to_csv('all.csv')
|
idmtools_platform_comps/tests/test_experiment_operations.py, test_list_assets used to return 5 files for the experiment, but now only return 1 file. is this new? |
Yes. Before, the assets would be duplicates. For example, an experiment with 5 simulations containing using the asset model1.py would contain 5 copies of model1.py |
I still need to update tests for this. Also, a note for you sharon. I tried using fixtures here to see how we could leverage these on COMPS specifically to reuse test data more often. This has some advantages of making some tests cleaner when we want to verify on multiple COMPS environments. I am not tied to it for this, but thought it would be worth exploring as I developed this |
before it was not 5 copies of model1.py. they are one model1.py and 4 different config.json from 4 simulations. |
Ah yes, those were incorrectly being listed under list_assets since they are not technically assets, but instead input files. They now show under list_files instead. |
assert EXPECTED_ASSETS_PER_MODEL1_EXPERIMENT == len(experiment_assets) | ||
assert experiment_assets[0].filename == "model1.py" | ||
assert experiment_assets[0].absolute_path is None | ||
assert experiment_assets[0].checksum == UUID('926ee7aa-4f29-bc94-ff99-8c5f83a6d85a') |
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 got different UUID:
test_file_listings.py:91 (test_list_files_experiment[python_files_and_assets_slurm2])
UUID('8e02e44c-5754-c79c-2b5c-9ffc5278c59c') != UUID('926ee7aa-4f29-bc94-ff99-8c5f83a6d85a')
I am using windows
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.
With files, there is no true UUID. Uuid is a checksum of the object
So we need to update this testcase |
examples/cookbook/download_files_from_comps.py download output.zip file now(used to unziped file) which is OK. but I can not unzip output.zip file(always throw some error) |
idmtools_platform_comps/tests/test_download_workitem.py has 2 tests failed: |
simulation_operations.py list_files with filters fail as
with error:
|
experiment_operations.py list_files return wrong files. following 2 cases should return same number of files: but second case return 0 file for all_linked_files = self.platform._experiments.list_files(e_p)
|
I see a difference in the two calls. One is called to list files for experiment and the other is listing files for experiment with children. The second(without children) will always return 0 files for COMPs since it does not support files(non shared assets) on experiments. |
@devclinton 1. docstr: simulation or experiment? File: idmtools_core/idmtools/entities/experiment.py
simulation --> experiment? 2. docstr: true --> True File: idmtools_core/idmtools/entities/experiment.py
--->
3. DownloadCommand is not used in anywhere Better to have a test for it. File: idmtools_core/idmtools/utils/download.py
4. Need to call normalize_filters(...)? File: idmtools_core/idmtools/utils/filters/asset_filters.py By definition:
If filter is type of str or List[str], the following line will fail:
in
Q: maybe we need to do the following first?
5. asset pass on all filters or just any one? File: idmtools_core/idmtools/utils/filters/asset_filters.py
Q: Pass all filters or just one? If we follow 'any' logic, then
-->
Note: adding break to avoid duplicated files added to result. If we follow 'all' logic, then
-->
6. What about the case: a.relative_path is None? File: idmtools_platform_comps/idmtools_platform_comps/comps_operations/asset_collection_operations.py
For the case a.relative_path is None, should we do the same?
7. Need to update comment There is a left over comment: # Send the assets for the experiment File: idmtools_platform_comps/idmtools_platform_comps/comps_operations/experiment_operations.py
8. Need to update docstr: Returns File: idmtools_platform_comps/idmtools_platform_comps/comps_operations/experiment_operations.py
Need to update
9. Missing parent in docstr Args File: idmtools_platform_comps/idmtools_platform_comps/comps_operations/simulation_operations.py
10. get_experiment_link is not called anywhere Better to have a usage/test case. File: idmtools_platform_comps/idmtools_platform_comps/comps_platform.py
|
this line always fail in debug mode or run 2 platforms
|
pycomps 2.5.0 fix suite id issue and it is already in prod artifactory. please also update pycomps version. |
Update/fix few tests in platform_comps
#1140
#1625
TODO add pytest-lazxfixture
TODO add ticket for support PathLink on download to path
TODO Add support for exclude filters to filter assets/files
TODO add ticket to add to local platform. Can be tackled outside of this PR
Depends on https://github.com/InstituteforDiseaseModeling/pyCOMPS/issues/39 for tests