schrodinger.application.livedesign.upload_utils module

class schrodinger.application.livedesign.upload_utils.CommandType

Bases: enum.Enum

An enumeration.

normal = 'NORMAL'
realtime = 'REALTIME'
click_to_run = 'CLICK_TO_RUN'
clustering = 'CLUSTERING'
schrodinger.application.livedesign.upload_utils.upload_ld_attachment(file_path, project_id, ld_client, remote_file_name=None)

Upload a file to LiveDesign as an attachment and return the corresponding attachment ID.

Parameters:
  • file_path (str) – the path to the file to be uploaded
  • project_id (int) – the ID of the LiveDesign project that the file should be uploaded to
  • remote_file_name (str or None) – the name of the attachment once uploaded; None, use the name of the file prior to upload
  • ld_client (ldclient.client.LDClient) – an instance of the LD client to use for the upload
schrodinger.application.livedesign.upload_utils.get_template_vars(template_data, template_class)

Provided a list containing LiveDesign attachment IDs and names, generate and return a list of template variables.

Parameters:
  • template_data (list of 2-tuple`s of (`int, str)) – a list of 2-`tuple`s containing LD attachment IDs and corresponding names
  • template_class (class) – the template class to initialize, from the downloaded ldclient.models module.
Returns:

a list of template variables

Return type:

list of ldclient.models.ModelTemplateVar

schrodinger.application.livedesign.upload_utils.get_model_by_name(ld_client, model_name, include_archived=True)

Retrieves a single model. Used in KNIME.

Parameters:
  • ld_client (ldclient.client.LDClient) – an instance of the LD client to get models
  • model_name (str) – Name of the model to retrieve
  • include_archived (bool) – Whether to include archived models or not. If False, ignore archived models
Returns:

Matched model object

Return type:

models.Model

schrodinger.application.livedesign.upload_utils.upload_ld_model(name, user_name, folder, project_id, template_vars, description, protocol_id, ld_client, model_class, model_recursive_class, command_type=<CommandType.normal: 'NORMAL'>, predictions=None, model_id=None, overwrite=False)

Create a LiveDesign model and upload it to a LiveDesign server.

Parameters:
  • name (str) – the name of the model
  • user_name (str) – the name of the user uploading this model
  • folder (str) – the directory path in which the model should be created on the LiveDesign server
  • project_id (int) – the ID of the LiveDesign project that the file should be uploaded to
  • template_vars – a list of template variables containing attachment data
  • description (str) – a description of the model
  • protocol_id (int) – the ID of the parent protocol for this model
  • ld_client (ldclient.client.LDClient) – an instance of the LD client to use for the upload
  • model_class (class) – the model class, from the downloaded ldclient.models module
  • model_recursive_class – the “model recursive class” that is necessary to build the model instance
Return type:

list of ldclient.models.ModelTemplateVar

:type model_recursive_class

Parameters:
  • command_type (CommandType) – Command type of the model to be uploaded
  • predictions (list of ldclient.models.ModelReturn) – the predictions to be added to the model
  • model_id (int) – Id of the model to be updated. If model_id is specified, ‘overwrite’ option will be ignored.
  • overwrite (bool) – If true and if exactly one model with ‘name’ already exists, then instead of creating a new one, update the model. If no model or more than one model exist with same name, then create a new model. If ‘model_id’ is specified, this option will be ignored and always the given model_id is updated.
Returns:

the model instance uploaded to the LiveDesign server, or None if the upload failed

Return type:

ldclient.models.Model, or None