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

Can not download AssetCollection files with platform.get_files_by_id #1574

Open
shchen-idmod opened this issue Jun 8, 2021 · 3 comments
Open

Comments

@shchen-idmod
Copy link
Collaborator

try to help Ye to download AssetCollection file to local as following code, but it throws error:

      try:
            out_filenames = [ 'ubuntu.sif']
            output_path = tempfile.mkdtemp()
            self.platform.get_files_by_id("978c1f34-f0c7-eb11-92dd-f0921c167860", ItemType.ASSETCOLLECTION,
                                           out_filenames, output_path)
        finally:
            shutil.rmtree(output_path)
in get_files_by_id
    return self.get_files(idm_item, files, output)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <Platform COMPSPlatform - id: c18b51bd6739785a97eb8c847e805ab7>
item = AssetCollection(_uid=UUID('978c1f34-f0c7-eb11-92dd-f0921c167860'), _IItem__pre_creation_hooks=[], _IItem__post_creatio...XHN0b3JhZ2VcQXNzZXRzXDk4Mlw5NzZcMTU0XDk4Mjk3NjE1LTRiODgtMjBhMC1kYTVlLTc4OGY4OGRiMzljOA__/ubuntu.sif"
        }
    ]
})
files = ['ubuntu.sif']
output = 'C:\\Users\\shchen\\AppData\\Local\\Temp\\tmpi2efa7w7', kwargs = {}
interface = '_assets'

    def get_files(self, item: IEntity, files: Union[Set[str], List[str]], output: str = None, **kwargs) -> \
            Union[Dict[str, Dict[str, bytearray]], Dict[str, bytearray]]:
        """
        Get files for a platform entity.
    
        Args:
            item: Item to fetch files for
            files: List of file names to get
            output: save files to
            **kwargs: Platform arguments
    
        Returns:
            For simulations, this returns a dictionary with filename as key and values being binary data from file or a
            dict.
    
            For experiments, this returns a dictionary with key as sim id and then the values as a dict of the
            simulations described above
        """
        if item.item_type not in self.platform_type_map.values():
            raise UnsupportedPlatformType("The provided type is invalid or not supported by this platform...")
        interface = ITEM_TYPE_TO_OBJECT_INTERFACE[item.item_type]
>       ret = getattr(self, interface).get_assets(item, files, **kwargs)
E       AttributeError: 'CompsPlatformAssetCollectionOperations' object has no attribute 'get_assets'

..\..\..\idmtools_core\idmtools\entities\iplatform.py:601: AttributeError
@shchen-idmod
Copy link
Collaborator Author

shchen-idmod commented Jun 8, 2021

Also DownloadWorkItem did not work either

@YeChen-IDM
Copy link
Collaborator

Thanks @shchen-idmod

@shchen-idmod
Copy link
Collaborator Author

Update:
This issue is still there.
example.py.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants