Hi Eric, In addition to what Isuru said, I wanted to clear up a point about the JavaScript SDK. That's an SDK to the Airavata Django Portal REST API which is a kind of bridge to the Thrift API via the airavata-python-sdk. That is, the JavaScript SDK doesn't call directly to the Thrift API.
In ascii art:
JS SDK ---> Django Portal REST API endpoints ---> Airavata Python Thrift Stubs
---> Airavata API
Just to give an example, the following from the JavaScript SDK:
> const loadAppInterface =
> services.ApplicationInterfaceService.retrieve({lookup: appInterfaceId});
>
>
Makes a GET request to the /api/application-interfaces/<appInterfaceId>/ REST
endpoint. This endpoint is implemented in the backend by
https://github.com/apache/airavata-django-portal/blob/master/django_airavata/apps/api/views.py#L701-L703
<https://github.com/apache/airavata-django-portal/blob/master/django_airavata/apps/api/views.py#L701-L703>
def get_instance(self, lookup_value):
return self.request.airavata_client.getApplicationInterface(
self.authz_token, lookup_value)
which as seen above calls the getApplicationInterface Airavata API method.
I hope that helps. As Isuru says, looking at the airavata-python-sdk and
perhaps especially the samples folder will make it clearer how to use the API.
Thanks,
Marcus
> On Oct 16, 2020, at 11:58 AM, Isuru Ranawaka <[email protected]> wrote:
>
> Hi Eric,
>
> Glad to hear that you are trying out Airavata services. The way you followed
> is correct. Please see the below steps on how to use Airavata thrift stubs.
>
> generate_thrift_stubs.sh
> <https://github.com/apache/airavata/blob/master/thrift-interface-descriptions/generate-thrift-stubs.sh>.
> supports c++, Java, and Python by default. For the Ruby, we need to add a
> script to generate ruby files (I assume you correctly did It)
> Once you run, It should generate Ruby stubs and data models (Those are the
> ones you listed above)
> Ruby stubs and data models are directly generated from thrift descriptions
> and currently, we don't have a Ruby template project to automatically
> organize them into a usable format.
> We need to copy those files into a separate Ruby project under
> airavata-client-sdks
> <https://github.com/apache/airavata/tree/master/airavata-api/airavata-client-sdks>
> as airavata-ruby- sdk and develop some ruby clients to utilize generated
> stubs and data models to connect with the Airavata services.
> You might have to look into airavata-python-sdk
> <https://github.com/apache/airavata/tree/master/airavata-api/airavata-client-sdks/airavata-python-sdk>
> to get some idea.
> We can help you with developing the Ruby SDK to use Airavata services and we
> will initialize the Ruby project on the Airavata git repo and you can look
> into that.
>
> thanks
> Isuru
>
>
>
>
>
>
>
> On Fri, Oct 16, 2020 at 11:19 AM Franz, Eric <[email protected]
> <mailto:[email protected]>> wrote:
> I was attempting to experiment with the testdrive Airavata instance from the
> Gateways tutorial. Since we have already setup an echo app and there is an
> example of using client sdk API library (in JavaScript) to both get a list of
> the running experiments and create and launch a new experiment, I thought I’d
> see if I could generate from the thrift idls the Ruby client library and
> plugin the API keys required to execute the same actions using Ruby.
>
>
>
> These are the steps I took. I cloned [email protected]:apache/airavata.git and
> modified thrift-interface-descriptions/generate-thrift-stubs.sh
> <mailto:[email protected]:apache/airavata.git%20and%20modified%20thrift-interface-descriptions/generate-thrift-stubs.sh>
> to add the generation of Ruby stubs. I copied the generate_python_stubs
> function and then change the --gen py to --gen rb and the location of the
> generation directory. I just had the target for now be
> airavata-api/airavata-client-sdks/airavata-ruby-sdk/airavata though I’d
> imagine in a proper setup the resulting airavata-ruby-sdk would be structured
> as a ruby gem with the stubs being added to the lib directory for that gem
> like a lib/airavata/ directory.
>
>
>
> Regardless the result was a list of Ruby files reprinted at the bottom of the
> email. Presumably I would also need the Ruby thrift gem to install. However,
> I realize I wasn’t actually sure where to go at this point, assuming that the
> steps I had taken were reasonable.
>
>
>
> I wasn’t sure what Python client sdk classes and methods corresponded to the
> JavaScript example from the tutorial (relevant parts copied below):
>
>
>
> <script src="{% static 'django_airavata_api/dist/airavata-api.js'
> %}"></script>
>
> <script>
>
> const { models, services, session, utils } = AiravataAPI;
>
>
>
>
>
> function loadExperiments() {
>
> return services.ExperimentSearchService.list({
>
> limit: 5,
>
> [models.ExperimentSearchFields.USER_NAME.name
> <http://models.experimentsearchfields.user_name.name/>]:
>
> session.Session.username,
>
> [models.ExperimentSearchFields.APPLICATION_ID.name
> <http://models.experimentsearchfields.application_id.name/>]: appInterfaceId
>
> }).then(data => {
>
>
>
>
>
>
>
> const loadAppInterface =
> services.ApplicationInterfaceService.retrieve({lookup: appInterfaceId});
>
> const loadQueues = services.ApplicationDeploymentService.getQueues({
> lookup: appDeploymentId });
>
> const loadWorkspacePrefs = services.WorkspacePreferencesService.get();
>
>
>
> Promise.all([loadAppInterface, loadWorkspacePrefs, loadQueues])
>
> .then(([appInterface, workspacePrefs, queues]) => {
>
> const experiment = appInterface.createExperiment();
>
>
>
> return services.ExperimentService.create({data: experiment});
>
> return services.ExperimentService.launch({lookup:
> exp.experimentId});
>
>
>
> Here is the list of rb files I generated below.
>
>
>
> ➜ airavata git:(master) ✗ ls -1
>
> .
>
> ..
>
> account_provisioning_model_constants.rb
>
> account_provisioning_model_types.rb
>
> airavata.rb
>
> airavata_api_constants.rb
>
> airavata_api_types.rb
>
> airavata_commons_constants.rb
>
> airavata_commons_types.rb
>
> airavata_data_models_constants.rb
>
> airavata_data_models_types.rb
>
> airavata_errors_constants.rb
>
> airavata_errors_types.rb
>
> airavata_workflow_model_constants.rb
>
> airavata_workflow_model_types.rb
>
> application_deployment_model_constants.rb
>
> application_deployment_model_types.rb
>
> application_interface_model_constants.rb
>
> application_interface_model_types.rb
>
> application_io_models_constants.rb
>
> application_io_models_types.rb
>
> base_a_p_i.rb
>
> base_api_constants.rb
>
> base_api_types.rb
>
> compute_resource_model_constants.rb
>
> compute_resource_model_types.rb
>
> credential-store-cpi_constants.rb
>
> credential-store-cpi_types.rb
>
> credential_store_data_models_constants.rb
>
> credential_store_data_models_types.rb
>
> credential_store_errors_constants.rb
>
> credential_store_errors_types.rb
>
> credential_store_service.rb
>
> data_movement_models_constants.rb
>
> data_movement_models_types.rb
>
> db_event_model_constants.rb
>
> db_event_model_types.rb
>
> experiment_model_constants.rb
>
> experiment_model_types.rb
>
> gateway_groups_model_constants.rb
>
> gateway_groups_model_types.rb
>
> gateway_resource_profile_model_constants.rb
>
> gateway_resource_profile_model_types.rb
>
> group-manager-cpi_constants.rb
>
> group-manager-cpi_types.rb
>
> group_manager_cpi_errors_constants.rb
>
> group_manager_cpi_errors_types.rb
>
> group_manager_model_constants.rb
>
> group_manager_model_types.rb
>
> group_manager_service.rb
>
> group_resource_profile_model_constants.rb
>
> group_resource_profile_model_types.rb
>
> iam-admin-services-cpi_constants.rb
>
> iam-admin-services-cpi_types.rb
>
> iam_admin_services.rb
>
> iam_admin_services_cpi_errors_constants.rb
>
> iam_admin_services_cpi_errors_types.rb
>
> job_model_constants.rb
>
> job_model_types.rb
>
> messaging_events_constants.rb
>
> messaging_events_types.rb
>
> parallelism_model_constants.rb
>
> parallelism_model_types.rb
>
> parser_model_constants.rb
>
> parser_model_types.rb
>
> process_model_constants.rb
>
> process_model_types.rb
>
> profile-service-cpi_constants.rb
>
> profile-service-cpi_types.rb
>
> profile-tenant-cpi_constants.rb
>
> profile-tenant-cpi_types.rb
>
> profile-user-cpi_constants.rb
>
> profile-user-cpi_types.rb
>
> profile_tenant_cpi_errors_constants.rb
>
> profile_tenant_cpi_errors_types.rb
>
> profile_user_cpi_errors_constants.rb
>
> profile_user_cpi_errors_types.rb
>
> replica_catalog_models_constants.rb
>
> replica_catalog_models_types.rb
>
> scheduling_model_constants.rb
>
> scheduling_model_types.rb
>
> security_model_constants.rb
>
> security_model_types.rb
>
> sharing_cpi_constants.rb
>
> sharing_cpi_types.rb
>
> sharing_models_constants.rb
>
> sharing_models_types.rb
>
> sharing_registry_service.rb
>
> status_models_constants.rb
>
> status_models_types.rb
>
> storage_resource_model_constants.rb
>
> storage_resource_model_types.rb
>
> task_model_constants.rb
>
> task_model_types.rb
>
> tenant_profile_model_constants.rb
>
> tenant_profile_model_types.rb
>
> tenant_profile_service.rb
>
> user_profile_model_constants.rb
>
> user_profile_model_types.rb
>
> user_profile_service.rb
>
> user_resource_profile_model_constants.rb
>
> user_resource_profile_model_types.rb
>
> workspace_model_constants.rb
>
> workspace_model_types.rb
>
>
>
>
>
> Thanks,
>
> Eric
>
>
>
> ---
>
> Eric Franz, Gateways Lead Engineer
>
> Ohio Supercomputer Center
>
> An Ohio Technology Consortium (OH-TECH) Member
>
> 1224 Kinnear Road
>
> Columbus, OH 43212
>
> email: [email protected] <mailto:[email protected]>
>
> --
> Research Software Engineer
> Indiana University, IN
>
smime.p7s
Description: S/MIME cryptographic signature
