runtime.apis package#

Submodules#

runtime.apis.data_management_engine module#

runtime.apis.data_management_engine.creat_index(auth, database, collection, index, info=False)#
runtime.apis.data_management_engine.create_document_collection_index(auth, database, collection, index, info=False)#
runtime.apis.data_management_engine.delete_db_documents(auth, database, collection, search, info=False)#
runtime.apis.data_management_engine.file_database_import(auth, file_name, database, collection, info=False)#
runtime.apis.data_management_engine.get_cassandra(auth, sql, ctype, info=False)#
runtime.apis.data_management_engine.get_cassandra_sql(auth, sql, info=False)#
runtime.apis.data_management_engine.get_cassandra_version(auth, params, info=False)#
runtime.apis.data_management_engine.get_data(auth, database, collection, field, limit, projections, skip, info=False)#

Get data from a MongoDB collection using the find syntax.

Parameters:
  • auth – Token for accessing the ecosystem-runtime. Created using access.

  • database – Name of the database.

  • collection – Name of the collection.

  • field – The mongodb find search query.

  • limit – The number of documents to return.

  • projections – The fields to include or exclude in mongodb find query format.

  • skip – The number of documents to skip.

Returns:

A list of all documents matching the find criteria.

runtime.apis.data_management_engine.get_data_sort(auth, database, collection, field, limit, projections, skip, sort, info=False)#
runtime.apis.data_management_engine.get_document_db_collections(auth, database, info=False)#
runtime.apis.data_management_engine.get_document_db_list(auth, server=None, info=False)#
runtime.apis.data_management_engine.rename_collection(auth, database, collection, new_collection, info=False)#
runtime.apis.data_management_engine.update_dynamic_parameters(auth, json, info=False)#
runtime.apis.data_management_engine.update_dynamic_parameters_multi(auth, json, info=False)#

runtime.apis.predictor_engine module#

runtime.apis.predictor_engine.generate_class(auth, code, package_name=None, class_name=None, output_dir=None, info=False)#

Generates a java class file in the runtime from the code in the code parameter.

Parameters:
  • auth – Token for accessing the ecosystem-runtime. Created using jwt_access.

  • code – The code to be converted to a java class.

  • package_name – The package name to be used for the java class.

  • class_name – The class name to be used for the java class.

  • output_dir – The directory to which the java class will be written.

Returns:

A dictionary containing the details of the generated java class.

EXAMPLES:

Getting the post scoring code for a deployment, compiling the java code and pushing the resulting deployment to a runtime endpoint.

# Connect to the runtime and server
auth = jwt_access.Authenticate(server_path, server_user, ecosystem_password)
auth_runtime = access.Authenticate(runtime_path)
# Specify the deployment
deployment_id = "offer_recommend_dynamic"
version = "001"
project_id = "Community Edition Recommender"

# Get the deployment step and extract the post scoring logic
deployment_step = dm.get_deployment_step(auth, project_id, deployment_id, version)
post_score_code = deployment_step["plugins"]["post_score_class_code"]
# Compile the post scoring logic file and add the new file name to the deployment step
compile_results = o.generate_class(auth_runtime, post_score_code)
deployment_step["plugins"]["post_score_class_text"] = compile_results["javaFileName"]
# Save the new deployment step
dm.update_deployment_step(auth, project_id, deployment_id, version, deployment_step)

#Push deployment and produce properties file
push_result = ge.process_push(auth,deployment_step)
if "ErrorMessage" in push_result:
    print(push_result["ErrorMessage"])
else:
    print(push_result["properties"])

An example of the response returned as a result of the class generation.

{
  "packagePath": "com/ecosystem/plugin/customer",
  "outputDir": "/app",
  "fullyQualifiedClassName": "com.ecosystem.plugin.customer.PlatformDynamicEngagement_39dhk",
  "methods": [
    {
      "name": "getPostPredict",
      "returnType": "void"
    },
    {
      "name": "getPostPredict",
      "returnType": "class org.json.JSONObject"
    }
  ],
  "javaFileName": "PlatformDynamicEngagement_39dhk.java",
  "className": "PlatformDynamicEngagement",
  "classNameUnique": "PlatformDynamicEngagement_39dhk"
}
runtime.apis.predictor_engine.generate_key(auth, info=False)#
runtime.apis.predictor_engine.get_offer_recommendations(auth, campaign, channel, customer, headers, numberoffers, params, subcampaign, userid, info=False)#
runtime.apis.predictor_engine.get_personality_recommender(auth, campaign, channel, customer, headers, numberoffers, params, subcampaign, userid, info=False)#
runtime.apis.predictor_engine.get_spending_personality(auth, campaign, channel, customer, headers, params, subcampaign, userid, info=False)#
runtime.apis.predictor_engine.invocations(auth, json, info=False)#

Call the invocations endpoint of the ecosystem-runtime. This is the generic endpoint for making predictions using the ecosystem-runtime.

Parameters:
  • auth – Token for accessing the ecosystem-runtime. Created using jwt_access.

  • json – The parameters to be passed to the invocations api.

EXAMPLES:

Call the invocations endpoint for a deployment with the deployment_id of “demo_deployment” and the customer lookup of 1234567.

offer_response = o.invocations(
                                auth,
                                {
                                "campaign": "demo_deployment",
                                "subcampaign": "none",
                                "channel": "notebooks",
                                "customer": 1234567,
                                "userid": "ecosystem",
                                "numberoffers": 4,
                                "params": "{}"
                                }
                              )
runtime.apis.predictor_engine.model_detail(auth, model, info=False)#
runtime.apis.predictor_engine.predictor_response_preload(auth, detail, value, info=False)#
runtime.apis.predictor_engine.predictor_response_preload_kafka(auth, detail, value, info=False)#
runtime.apis.predictor_engine.process_batch(auth, json, info=False)#
runtime.apis.predictor_engine.put_offer_recommendations(auth, document, headers, info=False)#
runtime.apis.predictor_engine.put_personality_recommender(auth, document, headers, info=False)#
runtime.apis.predictor_engine.put_spending_personality(auth, document, headers, info=False)#
runtime.apis.predictor_engine.refresh(auth, headers, info=False)#
runtime.apis.predictor_engine.response(auth, json, info=False)#
runtime.apis.predictor_engine.run_model_mojo(auth, detail, value, info=False)#

runtime.apis.restart_controller module#

runtime.apis.restart_controller.restart(auth, info=False)#
runtime.apis.restart_controller.restart_app(auth, info=False)#

runtime.apis.runtime_engine module#

runtime.apis.runtime_engine.login(auth, info=False)#
runtime.apis.runtime_engine.no_auth_ping(server, endpoint, headers, message, info=False)#
runtime.apis.runtime_engine.ping(auth, message, info=False)#

runtime.apis.worker_utilities module#

runtime.apis.worker_utilities.behavior_recommender(auth, campaign, channel, customer, params, subcampaign, userid, info=False)#
runtime.apis.worker_utilities.close_cassandra(auth, info=False)#
runtime.apis.worker_utilities.connect_u(auth, msisdn, payment_method, campaign_id, sub_campaign_id, channel_name, number_of_offers, user_id, params, info=False)#
runtime.apis.worker_utilities.estore_recommendations(auth, msisdn, payment_method, campaign_id, sub_campaign_id, channel_name, number_of_offers, user_id, params, info=False)#
runtime.apis.worker_utilities.estore_recommender_non_gsm(auth, msisdn, payment_method, campaign_id, sub_campaign_id, channel_name, number_of_offers, user_id, params, info=False)#
runtime.apis.worker_utilities.file_database_import(auth, database, collection, file_name, info=False)#
runtime.apis.worker_utilities.get_cassandra(auth, sql, c_type, info=False)#
runtime.apis.worker_utilities.get_cassandra_version(auth, params, info=False)#
runtime.apis.worker_utilities.get_file(auth, file_name, lines, info=False)#
runtime.apis.worker_utilities.get_file_list(auth, info=False)#
runtime.apis.worker_utilities.get_financial_wellness(auth, campaign, channel, customer, params, subcampaign, userid, info=False)#
runtime.apis.worker_utilities.get_ip(auth, info=False)#
runtime.apis.worker_utilities.get_property(auth, property_key, info=False)#
runtime.apis.worker_utilities.get_rest(auth, path, info=False)#
runtime.apis.worker_utilities.get_spend_personality(auth, campaign, channel, customer, params, subcampaign, userid, info=False)#
runtime.apis.worker_utilities.gift_recommendations_free(auth, msisdn, payment_method, campaign_id, sub_campaign_id, channel_name, number_of_offers, user_id, params, transaction_id, info=False)#
runtime.apis.worker_utilities.gift_recommendations_purchased(auth, msisdn, payment_method, campaign_id, sub_campaign_id, channel_name, number_of_offers, user_id, params, transaction_id, info=False)#
runtime.apis.worker_utilities.just_for_you(auth, msisdn, payment_method, campaign_id, sub_campaign_id, channel_name, number_of_offers, user_id, params, info=False)#
runtime.apis.worker_utilities.list_to_matrix(auth, params, info=False)#
runtime.apis.worker_utilities.matrix_to_list(auth, params, info=False)#
runtime.apis.worker_utilities.pull_kafka_topic(auth, message, params, info=False)#
runtime.apis.worker_utilities.push_kafka_topic(auth, message, params, info=False)#
runtime.apis.worker_utilities.put_behavior_recommender(auth, document, info=False)#
runtime.apis.worker_utilities.put_connect_u(auth, document, info=False)#
runtime.apis.worker_utilities.put_estore_recommendations(auth, document, info=False)#
runtime.apis.worker_utilities.put_estore_recommender_non_gsm(auth, document, info=False)#
runtime.apis.worker_utilities.put_financial_wellness(auth, document, info=False)#
runtime.apis.worker_utilities.put_gift_recommendations(auth, document, info=False)#
runtime.apis.worker_utilities.put_just_for_you(auth, document, info=False)#
runtime.apis.worker_utilities.refresh(auth, info=False)#
runtime.apis.worker_utilities.send_get(auth, path, proxy, port, info=False)#
runtime.apis.worker_utilities.sql_cassandra(auth, sql, info=False)#
runtime.apis.worker_utilities.test_kafka_kerberos(auth, info=False)#
runtime.apis.worker_utilities.update_properties(auth, properties, info=False)#
runtime.apis.worker_utilities.update_properties_key(auth, key, value, info=False)#
runtime.apis.worker_utilities.upload_file(auth, path, target_path, info=False)#

Module contents#