parameters: (self,
                           source: typing.Union[gmxapi.abc.Context, ModuleObject, None],
                           target: gmxapi.abc.Context = None)
docstring: Get a resource factory for use in the target context.
  
          The returned factory takes input from the source context and provides it in a form
          usable by the operation builder in the target context.
docstring_summary: Get a resource factory for use in the target context.
docstring_tokens: Get a resource factory for use in the target context .
function: def resource_factory(self,
                           source: typing.Union[gmxapi.abc.Context, ModuleObject, None],
                           target: gmxapi.abc.Context = None):
          """Get a resource factory for use in the target context.
  
          The returned factory takes input from the source context and provides it in a form
          usable by the operation builder in the target context.
          """
          # Distinguish between the UIContext, in which input is in the form
          # of function call arguments, and the StandardContext, implemented in
          # gmxapi.operation. UIContext is probably a virtual context that is
          # asserted by callers in order to get a factory that normalizes UI input
          # for the StandardContext.
          #
          if target is None:
              target = self.context
          if source is None:
              # `source is None` implies source is coming from UI.
              if isinstance(target, _op.Context):
                  # Return a factory that can bind to function call arguments to produce a DataSourceCollection.
                  return _standard_node_resource_factory
          if isinstance(source, _op.Context):
              # The source is a gmxapi.operation.Context when the operation is being evaluated through
              # a gmxapi.operation.ResourceManager. i.e. at run time.
              return SubscriptionSessionResources
          if isinstance(source, ModuleObject):
              # In the UI context, the source may be a ModuleObject instead of `None`, per `mdrun`
              # defined below.
              if isinstance(target, _op.Context):
                  # We are creating a node in gmxapi.operation.Context from another gmxapi.simulation operation.
                  # This means that we want to subscribe to the subcontext instead of the gmxapi.operation.Context.
                  # In the first draft, though, we just access a special payload.
                  # Return a factory that will consume *_simulation_input* and *parameters*
                  # members of a received object.
                  logger.info('Building mdrun operation from source {}'.format(source))
  
                  def simulation_input_workaround(_simulation_input, runtime_args):
                      """Allows support for the as-yet-undefined SimulationInput resource.
  
                      Also supports a user interface in which the OutputDataProxy is not an
                      explicit attribute. See https://gitlab.com/gromacs/gromacs/-/issues/3174
                      """
                      source = _simulation_input
                      # Accept either an OutputDataProxy with appropriate members, or an abject
                      # that provides such an OutputDataProxy.
                      if hasattr(source, 'output'):
                          source = _simulation_input.output
                      assert hasattr(source, '_simulation_input')
                      assert hasattr(source, 'parameters')
                      logger.info('mdrun receiving input {}: {}'.format(source._simulation_input.name,
                                                                        source._simulation_input.description))
                      source_collection = _input.bind(
                          _simulation_input=source._simulation_input,
                          parameters=source.parameters,
                          runtime_args=runtime_args)
                      logger.info('mdrun input bound as source collection {}'.format(
                          source_collection))
                      return source_collection
  
                  return simulation_input_workaround
  
          raise gmxapi.exceptions.ValueError(
              f'No dispatching from {source} context to {target}')
function_tokens: def resource_factory ( self , source : typing . Union [ gmxapi . abc . Context , ModuleObject , None ] , target : gmxapi . abc . Context = None ) : # Distinguish between the UIContext, in which input is in the form # of function call arguments, and the StandardContext, implemented in # gmxapi.operation. UIContext is probably a virtual context that is # asserted by callers in order to get a factory that normalizes UI input # for the StandardContext. # if target is None : target = self . context if source is None : # `source is None` implies source is coming from UI. if isinstance ( target , _op . Context ) : # Return a factory that can bind to function call arguments to produce a DataSourceCollection. return _standard_node_resource_factory if isinstance ( source , _op . Context ) : # The source is a gmxapi.operation.Context when the operation is being evaluated through # a gmxapi.operation.ResourceManager. i.e. at run time. return SubscriptionSessionResources if isinstance ( source , ModuleObject ) : # In the UI context, the source may be a ModuleObject instead of `None`, per `mdrun` # defined below. if isinstance ( target , _op . Context ) : # We are creating a node in gmxapi.operation.Context from another gmxapi.simulation operation. # This means that we want to subscribe to the subcontext instead of the gmxapi.operation.Context. # In the first draft, though, we just access a special payload. # Return a factory that will consume *_simulation_input* and *parameters* # members of a received object. logger . info ( 'Building mdrun operation from source {}' . format ( source ) ) def simulation_input_workaround ( _simulation_input , runtime_args ) : """Allows support for the as-yet-undefined SimulationInput resource.
  
                      Also supports a user interface in which the OutputDataProxy is not an
                      explicit attribute. See https://gitlab.com/gromacs/gromacs/-/issues/3174
                      """ source = _simulation_input # Accept either an OutputDataProxy with appropriate members, or an abject # that provides such an OutputDataProxy. if hasattr ( source , 'output' ) : source = _simulation_input . output assert hasattr ( source , '_simulation_input' ) assert hasattr ( source , 'parameters' ) logger . info ( 'mdrun receiving input {}: {}' . format ( source . _simulation_input . name , source . _simulation_input . description ) ) source_collection = _input . bind ( _simulation_input = source . _simulation_input , parameters = source . parameters , runtime_args = runtime_args ) logger . info ( 'mdrun input bound as source collection {}' . format ( source_collection ) ) return source_collection return simulation_input_workaround raise gmxapi . exceptions . ValueError ( f'No dispatching from {source} context to {target}' )