You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by ma...@apache.org on 2019/09/13 18:29:52 UTC
[airavata-django-portal] branch master updated (c1890c3 -> ca4e6b8)
This is an automated email from the ASF dual-hosted git repository.
machristie pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/airavata-django-portal.git.
from c1890c3 Removing unused import
new 461dbc1 Adding convenience AppInterface.createExperiment method
new ca4e6b8 Removing unused data storage code
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
django_airavata/apps/api/datastore.py | 2 -
.../js/models/ApplicationInterfaceDefinition.js | 8 ++++
.../js/containers/CreateExperimentContainer.vue | 48 ++++++++++----------
django_airavata/apps/workspace/views.py | 52 ----------------------
4 files changed, 32 insertions(+), 78 deletions(-)
[airavata-django-portal] 02/02: Removing unused data storage code
Posted by ma...@apache.org.
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 <ma...@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
[airavata-django-portal] 01/02: Adding convenience
AppInterface.createExperiment method
Posted by ma...@apache.org.
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 461dbc10d219a340a50f55fcc53aa3717e255041
Author: Marcus Christie <ma...@apache.org>
AuthorDate: Fri Sep 13 14:29:30 2019 -0400
Adding convenience AppInterface.createExperiment method
---
.../js/models/ApplicationInterfaceDefinition.js | 8 ++++
.../js/containers/CreateExperimentContainer.vue | 48 +++++++++++-----------
2 files changed, 32 insertions(+), 24 deletions(-)
diff --git a/django_airavata/apps/api/static/django_airavata_api/js/models/ApplicationInterfaceDefinition.js b/django_airavata/apps/api/static/django_airavata_api/js/models/ApplicationInterfaceDefinition.js
index 9ca07f0..8aa28e2 100644
--- a/django_airavata/apps/api/static/django_airavata_api/js/models/ApplicationInterfaceDefinition.js
+++ b/django_airavata/apps/api/static/django_airavata_api/js/models/ApplicationInterfaceDefinition.js
@@ -2,6 +2,7 @@ import BaseModel from "./BaseModel";
import InputDataObjectType from "./InputDataObjectType";
import OutputDataObjectType from "./OutputDataObjectType";
import DataType from "./DataType";
+import Experiment from "./Experiment";
const FIELDS = [
"applicationInterfaceId",
@@ -60,4 +61,11 @@ export default class ApplicationInterfaceDefinition extends BaseModel {
}
this.applicationOutputs.push(stdout, stderr);
}
+
+ createExperiment() {
+ const experiment = new Experiment();
+ experiment.populateInputsOutputsFromApplicationInterface(this);
+ experiment.executionId = this.applicationInterfaceId;
+ return experiment;
+ }
}
diff --git a/django_airavata/apps/workspace/static/django_airavata_workspace/js/containers/CreateExperimentContainer.vue b/django_airavata/apps/workspace/static/django_airavata_workspace/js/containers/CreateExperimentContainer.vue
index 6c93a6e..ff17345 100644
--- a/django_airavata/apps/workspace/static/django_airavata_workspace/js/containers/CreateExperimentContainer.vue
+++ b/django_airavata/apps/workspace/static/django_airavata_workspace/js/containers/CreateExperimentContainer.vue
@@ -11,7 +11,7 @@
</template>
<script>
-import { models, services } from "django-airavata-api";
+import { services } from "django-airavata-api";
import { notifications } from "django-airavata-common-ui";
import ExperimentEditor from "../components/experiment/ExperimentEditor.vue";
import urls from "../utils/urls";
@@ -37,40 +37,40 @@ export default {
},
handleSavedAndLaunchedExperiment: function(experiment) {
// Redirect to experiment view
- urls.navigateToViewExperiment(experiment, {launching: true});
+ urls.navigateToViewExperiment(experiment, { launching: true });
}
},
computed: {},
mounted: function() {
- const experiment = new models.Experiment();
const loadAppModule = services.ApplicationModuleService.retrieve(
{ lookup: this.appModuleId },
{ ignoreErrors: true }
- ).then(appModule => {
- experiment.experimentName =
- appModule.appModuleName + " on " + moment().format("lll");
- this.appModule = appModule;
- });
+ );
const loadAppInterface = services.ApplicationModuleService.getApplicationInterface(
{ lookup: this.appModuleId },
{ ignoreErrors: true }
- ).then(appInterface => {
- experiment.populateInputsOutputsFromApplicationInterface(appInterface);
- if (this.userInputFiles) {
- Object.keys(this.userInputFiles).forEach(k => {
- const experimentInput = experiment.experimentInputs.find(inp => inp.name === k);
- if (experimentInput) {
- experimentInput.value = this.userInputFiles[k];
- }
- })
- }
- experiment.executionId = appInterface.applicationInterfaceId;
- });
- if (this.experimentDataDir) {
- experiment.userConfigurationData.experimentDataDir = this.experimentDataDir;
- }
+ );
Promise.all([loadAppModule, loadAppInterface])
- .then(() => (this.experiment = experiment))
+ .then(([appModule, appInterface]) => {
+ const experiment = appInterface.createExperiment();
+ experiment.experimentName =
+ appModule.appModuleName + " on " + moment().format("lll");
+ this.appModule = appModule;
+ if (this.userInputFiles) {
+ Object.keys(this.userInputFiles).forEach(k => {
+ const experimentInput = experiment.experimentInputs.find(
+ inp => inp.name === k
+ );
+ if (experimentInput) {
+ experimentInput.value = this.userInputFiles[k];
+ }
+ });
+ }
+ if (this.experimentDataDir) {
+ experiment.userConfigurationData.experimentDataDir = this.experimentDataDir;
+ }
+ this.experiment = experiment;
+ })
.catch(error => {
notifications.NotificationList.addError(error);
});