schrodinger.application.transforms.livedesign module

Transforms that interact with LiveDesign

class schrodinger.application.transforms.livedesign.LDClientDoFn(host: str, username: str, password: str)

Bases: DoFn

A DoFn that can interact with a LiveDesign server using the client returned from self.getClient()

__init__(host: str, username: str, password: str)
getClient() LDClientProxy

Get a LDClientProxy that is connected with the given credentials in this DoFn

teardown()

Called to use to clean up this instance before it is discarded.

A runner will do its best to call this method on any given instance to prevent leaks of transient resources, however, there may be situations where this is impossible (e.g. process crash, hardware failure, etc.) or unnecessary (e.g. the pipeline is shutting down and the process is about to be killed anyway, so all transient resources will be released automatically by the OS). In these cases, the call may not happen. It will also not be retried, because in such situations the DoFn instance no longer exists, so there’s no instance to retry it on.

Thus, all work that depends on input elements, and all externally important side effects, must be performed in DoFn.process or DoFn.finish_bundle.

class schrodinger.application.transforms.livedesign.ReadLiveReport(host: str, username: str, password: str)

Bases: PTransform

A PTransform that reads LiveReports from LiveDesign given the input PCollection of LiveReport IDs

Example usage::
>>> import apache_beam as beam
>>> from schrodinger.application.transforms.livedesign import ReadLiveReport
>>> with beam.Pipeline() as p:
...     rows = (
...         p
...         | beam.Create(['1234'])
...         | ReadLiveReport(host='<LD_HOST>',
...                          username='<LD_USERNAME>',
...                          password='<LD_PASSWORD>'
...     )
__init__(host: str, username: str, password: str)
expand(live_report_ids: PCollection[str]) PCollection[Row]
class schrodinger.application.transforms.livedesign.ReadFromLiveReport(host: str, username: str, password: str, live_report_id: str)

Bases: PTransform

A PTransform that reads a single LiveReport from LiveDesign given the specified LiveReport ID

Example usage::
>>> import apache_beam as beam
>>> from schrodinger.application.transforms.livedesign import ReadFromLiveReport
>>> with beam.Pipeline() as p:
...     rows = (
...         p
...         | ReadFromLiveReport(host='<LD_HOST>',
...                              username='<LD_USERNAME>',
...                              password='<LD_PASSWORD>',
...                              live_report_id='1234')
...     )
__init__(host: str, username: str, password: str, live_report_id: str)
expand(pbegin) PCollection[Row]