Execute the sequence of transformations in parallel
        :param sequence: Sequence to evaluation
        :param transformations: Transformations to apply
        :return: Resulting sequence or value
335188
def evaluate(self, sequence, transformations):
        
        result = sequence
        parallel = partial(
            parallelize, processes=self.processes, partition_size=self.partition_size)
        staged = []
        for transform in transformations:
            strategies = transform.execution_strategies or {}
            if ExecutionStrategies.PARALLEL in strategies:
                staged.insert(0, transform.function)
            else:
                if staged:
                    result = parallel(compose(*staged), result)
                    staged = []
                if ExecutionStrategies.PRE_COMPUTE in strategies:
                    result = list(result)
                result = transform.function(result)
        if staged:
            result = parallel(compose(*staged), result)
        return iter(result)
671623
def _process_transform(self, data, transform, step_size):
    '''
    
    '''
    if isinstance(transform, (list,tuple,set)):
      return { t : self._transform(data,t,step_size) for t in transform }
    elif isinstance(transform, dict):
      return { tn : self._transform(data,tf,step_size) for tn,tf in transform.items() }
    return self._transform(data,transform,step_size)
540212
private void sequenceCommand(long sequence, ServerSessionContext session, CompletableFuture<Result> future, ThreadContext context) {
    if (!log.isOpen()) {
      context.executor().execute(() -> future.completeExceptionally(new IllegalStateException("log closed")));
      return;
    }

    Result result = session.getResult(sequence);
    if (result == null) {
      LOGGER.debug("Missing command result for {}:{}", session.id(), sequence);
    }
    context.executor().execute(() -> future.complete(result));
  }
367779
public static <T> List<T> reorderIf( RandSeq randSeq, List<T> sequence)
    {
    return randSeq==null? sequence : randSeq.reorder( sequence);
    }
743671
def do_execute(self):
        
        evl = self.input.payload
        if isinstance(evl, Evaluation):
            summary = evl.summary(title=self.resolve_option("title"), complexity=bool(self.resolve_option("complexity")))
            if bool(self.resolve_option("matrix")):
                summary += "\n" + evl.matrix(title=self.resolve_option("title"))
        else:
            summary = evl.cluster_results
        self._output.append(Token(summary))
        return None
594723
def convertSequenceMachineSequence(generatedSequences):
  
  sequenceList = []
  currentSequence = []
  for s in generatedSequences:
    if s is None:
      sequenceList.append(currentSequence)
      currentSequence = []
    else:
      currentSequence.append(s)

  return sequenceList
1252743
def change_sequence(flow, &block)
      SEQUENCE_LOCK.synchronize do
        old_seq = sequence
        new_seq = @sequence = sequence.pull(flow)
        (@seq_logger ||= [old_seq]) << new_seq
        if block
          result = block.()
          on_sequence_changed(old_seq, flow, new_seq)
          result
        else
          on_sequence_changed(old_seq, flow, new_seq)
          nil
        end
      end
    end
554144
def tails_t(wrap):
    
    return Transformation(
        'tails',
        lambda sequence: [wrap(sequence[i:]) for i in range(len(sequence) + 1)],
        {ExecutionStrategies.PRE_COMPUTE}
    )
132019
def call_each(seq):
    
    try:
        reduce(lambda _, y: y(), seq)
    except TypeError as e:
        if text_type(e) != "reduce() of empty sequence with no initial value":
            raise
87735
def create_sequence(context)
      pid_callback = lambda do |sequence|
        @mutex.synchronize { @pid = sequence.pid }
      end
      return RightScale::ExecutableSequenceProxy.new(context, :pid_callback => pid_callback )
    end
244709
def _run_sequence(self, sequence):
        '''
        
        '''
        self._check_pause()
        self._pre_test()
        session_data = self.target.get_session_data()
        self._test_info()
        resp = None
        for edge in sequence:
            if edge.callback:
                edge.callback(self, edge, resp)
            session_data = self.target.get_session_data()
            node = edge.dst
            node.set_session_data(session_data)
            resp = self._transmit(node)
        return self._post_test()
456030
private void sequenceQuery(QueryEntry entry, CompletableFuture<QueryResponse> future) {
    // Get the client's server session. If the session doesn't exist, return an unknown session error.
    ServerSessionContext session = context.getStateMachine().executor().context().sessions().getSession(entry.getSession());
    if (session == null) {
      future.complete(logResponse(QueryResponse.builder()
        .withStatus(Response.Status.ERROR)
        .withError(CopycatError.Type.UNKNOWN_SESSION_ERROR)
        .build()));
    } else {
      sequenceQuery(entry, session, future);
    }
  }
1318126
def _ensure_sequence(self, mutable=False):
        
        if self.is_sequence:
            # if we need a mutable object, we ensure it's a list.
            if mutable and not isinstance(self.response, list):
                self.response = list(self.response)
            return
        if self.direct_passthrough:
            raise RuntimeError('Attempted implicit sequence conversion '
                               'but the response object is in direct '
                               'passthrough mode.')
        if not self.implicit_sequence_conversion:
            raise RuntimeError('The response object required the iterable '
                               'to be a sequence, but the implicit '
                               'conversion was disabled.  Call '
                               'make_sequence() yourself.')
        self.make_sequence()
130380
def _transform(self, value):
        
        if self.transform:
            try:
                value = self.transform(value)
            except:
                import sys
                exc_type, exc_obj, exc_tb = sys.exc_info()
                raise AssertionError('Error applying transformation <{0}>: {2}: {3}'.format(
                    self.transform.__name__, value, exc_type.__name__, exc_obj))

        return value
87275
def flatten(sequence):
    
    for item in sequence:
        if hasattr(item, "__iter__") and not isinstance(item, str) and not isinstance(item, bytes):
            for i in item:
                yield i
        else:
            yield item
493588
public void execute()
        throws MojoExecutionException, MojoFailureException
    {
        if ( isSkipping() )
        {
            getLog().debug( "Skipping execution, as demanded by user." );
            return;
        }
        if ( transformationSets == null || transformationSets.length == 0 )
        {
            throw new MojoFailureException( "No TransformationSets configured." );
        }
        checkCatalogHandling();

        Object oldProxySettings = activateProxy();
        try
        {
            Resolver resolver = getResolver();
            for ( int i = 0; i < transformationSets.length; i++ )
            {
                TransformationSet transformationSet = transformationSets[i];
                resolver.setXincludeAware( transformationSet.isXincludeAware() );
                resolver.setValidating( transformationSet.isValidating() );
                transform( resolver, transformationSet );
            }
        }
        finally
        {
            passivateProxy( oldProxySettings );
        }
    }
1325082
private void sequenceQuery(QueryEntry entry, ServerSessionContext session, CompletableFuture<QueryResponse> future) {
    // If the query's sequence number is greater than the session's current sequence number, queue the request for
    // handling once the state machine is caught up.
    if (entry.getSequence() > session.getCommandSequence()) {
      session.registerSequenceQuery(entry.getSequence(), () -> indexQuery(entry, future));
    } else {
      indexQuery(entry, future);
    }
  }