You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@airavata.apache.org by "Marcus Christie (Jira)" <ji...@apache.org> on 2020/06/26 21:48:00 UTC

[jira] [Comment Edited] (AIRAVATA-3342) Implement SDK function for managing user storage

    [ https://issues.apache.org/jira/browse/AIRAVATA-3342?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17146659#comment-17146659 ] 

Marcus Christie edited comment on AIRAVATA-3342 at 6/26/20, 9:47 PM:
---------------------------------------------------------------------

Tried to integrate testing, but I'm getting stuck on trying to have a test UserFiles db model.

{code}
======================================================================
ERROR: tests.test_user_storage (unittest.loader._FailedTest)
----------------------------------------------------------------------
ImportError: Failed to import test module: tests.test_user_storage
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/unittest/loader.py", line 428, in _find_test_path
    module = self._get_module_from_name(name)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/unittest/loader.py", line 369, in _get_module_from_name
    __import__(name)
  File "/Users/machrist/Airavata/django/airavata-django-portal-sdk/tests/test_user_storage.py", line 21, in <module>
    class TestUserFiles(base.UserFiles):
  File "/Users/machrist/Airavata/django/airavata-django-portal-sdk/venv/lib/python3.6/site-packages/django/db/models/base.py", line 115, in __new__
    "INSTALLED_APPS." % (module, name)
RuntimeError: Model class tests.test_user_storage.TestUserFiles doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.
{code}

Django really wants models to be in apps and come to think of it, having the SDK be an app would mean I could just define the UserFiles model directly instead of needing an abstract model that is actually implemented in the airavata-django-portal.

The other approach I think is to remove all of the Django code from the SDK, but I'm not sure how far that can go. I would need to provide abstractions so that Django implementations of functionality can be plugged in. I suppose if that were under the covers and not exposed to users of the SDK, that could work.



was (Author: marcuschristie):
Tried to integrate testing, but I'm getting stuck on trying to have a test UserFiles db model.

```
======================================================================
ERROR: tests.test_user_storage (unittest.loader._FailedTest)
----------------------------------------------------------------------
ImportError: Failed to import test module: tests.test_user_storage
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/unittest/loader.py", line 428, in _find_test_path
    module = self._get_module_from_name(name)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/unittest/loader.py", line 369, in _get_module_from_name
    __import__(name)
  File "/Users/machrist/Airavata/django/airavata-django-portal-sdk/tests/test_user_storage.py", line 21, in <module>
    class TestUserFiles(base.UserFiles):
  File "/Users/machrist/Airavata/django/airavata-django-portal-sdk/venv/lib/python3.6/site-packages/django/db/models/base.py", line 115, in __new__
    "INSTALLED_APPS." % (module, name)
RuntimeError: Model class tests.test_user_storage.TestUserFiles doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.
```

Django really wants models to be in apps and come to think of it, having the SDK be an app would mean I could just define the UserFiles model directly instead of needing an abstract model that is actually implemented in the airavata-django-portal.

The other approach I think is to remove all of the Django code from the SDK, but I'm not sure how far that can go. I would need to provide abstractions so that Django implementations of functionality can be plugged in. I suppose if that were under the covers and not exposed to users of the SDK, that could work.

> Implement SDK function for managing user storage
> ------------------------------------------------
>
>                 Key: AIRAVATA-3342
>                 URL: https://issues.apache.org/jira/browse/AIRAVATA-3342
>             Project: Airavata
>          Issue Type: Sub-task
>            Reporter: Marcus Christie
>            Assignee: Marcus Christie
>            Priority: Major
>
> An initial version of the user file management aspects of the SDK were implemented in the maptool custom Django app: https://github.com/SciGaP/simccs-maptool/blob/dev/simccs_maptool/django_airavata_sdk.py
> The API need not have exactly the same signature, but that implementation should make clear the kind of functionality that should be offered.
> TODO
> - [ ] put the airavata_python_sdk into a module? Right now the top level modules are `clients`, `samples`, `transport`. Also the there is a `build` directory there with duplicates of the python modules?
> - [ ] generate documentation for public API
> - [ ] have django_airavata_api.User_Files extend sdk's UserFiles and might as well set the {{settings.USER_FILES_MODEL}}
> - [ ] switch airavata-django-portal code over to using SDK
> - [ ] move data_products_helper tests to SDK
> - [ ] access control? how to determine if user has access to files?
> - [ ] setup apache repo to push the sdk to
> - [ ] make the SDK a proper Django app, this will ease testing and integration



--
This message was sent by Atlassian Jira
(v8.3.4#803005)