This is an automated email from the ASF dual-hosted git repository. machristie pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/airavata-django-portal.git
commit ca4e6b896492e054cebbd1b16edae11b7fd5b21e Author: Marcus Christie <machris...@apache.org> AuthorDate: Fri Sep 13 14:29:41 2019 -0400 Removing unused data storage code --- django_airavata/apps/api/datastore.py | 2 -- django_airavata/apps/workspace/views.py | 52 --------------------------------- 2 files changed, 54 deletions(-) diff --git a/django_airavata/apps/api/datastore.py b/django_airavata/apps/api/datastore.py index 8d62750..82392de 100644 --- a/django_airavata/apps/api/datastore.py +++ b/django_airavata/apps/api/datastore.py @@ -7,8 +7,6 @@ from django.core.exceptions import ObjectDoesNotExist, SuspiciousFileOperation from django.core.files.move import file_move_safe from django.core.files.storage import FileSystemStorage -experiment_data_storage = FileSystemStorage( - location=settings.GATEWAY_DATA_STORE_DIR) logger = logging.getLogger(__name__) diff --git a/django_airavata/apps/workspace/views.py b/django_airavata/apps/workspace/views.py index e4dbd9b..67b7f1a 100644 --- a/django_airavata/apps/workspace/views.py +++ b/django_airavata/apps/workspace/views.py @@ -148,55 +148,3 @@ def user_storage(request): return render(request, 'django_airavata_workspace/base.html', { 'bundle_name': 'user-storage' }) - - -experiment_data_storage = FileSystemStorage( - location=settings.GATEWAY_DATA_STORE_DIR) - - -@login_required -def upload_input_file(request): - try: - # Save input file to username/project name/exp name/filename - username = request.user.username - project_id = request.POST['project-id'] - project = request.airavata_client.getProject( - request.authz_token, project_id) - exp_name = request.POST['experiment-name'] - input_file = request.FILES['file'] - exp_dir = os.path.join( - experiment_data_storage.get_valid_name(username), - experiment_data_storage.get_valid_name(project.name), - experiment_data_storage.get_valid_name(exp_name)) - file_path = os.path.join( - exp_dir, - experiment_data_storage.get_valid_name(input_file.name)) - input_file_name = experiment_data_storage.save(file_path, input_file) - input_file_fullpath = experiment_data_storage.path(input_file_name) - # Register DataProductModel with DataReplicaLocationModel - data_product = DataProductModel() - data_product.gatewayId = settings.GATEWAY_ID - data_product.ownerName = username - data_product.productName = input_file.name - data_product.dataProductType = DataProductType.FILE - data_replica_location = DataReplicaLocationModel() - data_replica_location.storageResourceId = \ - settings.GATEWAY_DATA_STORE_RESOURCE_ID - data_replica_location.replicaName = \ - "{} gateway data store copy".format(input_file.name) - data_replica_location.replicaLocationCategory = \ - ReplicaLocationCategory.GATEWAY_DATA_STORE - data_replica_location.replicaPersistentType = \ - ReplicaPersistentType.TRANSIENT - hostname = urlparse(request.build_absolute_uri()).hostname - data_replica_location.filePath = \ - "file://{}:{}".format(hostname, input_file_fullpath) - data_product.replicaLocations = [data_replica_location] - data_product_uri = request.airavata_client.registerDataProduct( - request.authz_token, data_product) - return JsonResponse({'uploaded': True, - 'data-product-uri': data_product_uri}) - except Exception as e: - resp = JsonResponse({'uploaded': False, 'error': str(e)}) - resp.status_code = 500 - return resp