Returns an input shard state for the remaining inputs.

    Returns:
      A json-izable version of the remaining InputReader.
549998
def to_json(self):
    

    return {self.BLOB_KEY_PARAM: self._blob_key,
            self.START_FILE_INDEX_PARAM: self._start_file_index,
            self.END_FILE_INDEX_PARAM: self._end_file_index,
            self.OFFSET_PARAM: self._next_offset()}
1169113
def get_sha_blob(self):
        
        r = requests.get(self.api_url, auth=self.get_auth_details())
        try:
            return r.json()['sha']
        except KeyError:
            return None
749224
def split_input(cls, mapper_spec):
    
    params = _get_params(mapper_spec)
    shard_count = mapper_spec.shard_count

    # Pick out the overall start and end times and time step per shard.
    start_time = params[cls.START_TIME_PARAM]
    end_time = params[cls.END_TIME_PARAM]
    seconds_per_shard = (end_time - start_time) / shard_count

    # Create a LogInputReader for each shard, modulating the params as we go.
    shards = []
    for _ in xrange(shard_count - 1):
      params[cls.END_TIME_PARAM] = (params[cls.START_TIME_PARAM] +
                                    seconds_per_shard)
      shards.append(LogInputReader(**params))
      params[cls.START_TIME_PARAM] = params[cls.END_TIME_PARAM]

    # Create a final shard to complete the time range.
    params[cls.END_TIME_PARAM] = end_time
    return shards + [LogInputReader(**params)]
273220
def _w_within_shard(args: Dict[str, Any]):
    """"""
    index = args['index']
    half_turns = args['half_turns']
    axis_half_turns = args['axis_half_turns']
    state = _state_shard(args)
    pm_vect = _pm_vects(args)[index]
    num_shard_qubits = args['num_shard_qubits']
    shard_size = 2 ** num_shard_qubits

    reshape_tuple = (2 ** (num_shard_qubits - 1 - index), 2, 2 ** index)
    perm_state = np.reshape(
        np.reshape(state, reshape_tuple)[:, ::-1, :], shard_size)
    cos = np.cos(-0.5 * np.pi * half_turns)
    sin = np.sin(-0.5 * np.pi * half_turns)

    cos_axis = np.cos(np.pi * axis_half_turns)
    sin_axis = np.sin(np.pi * axis_half_turns)

    new_state = cos * state + 1j * sin * perm_state * (
        cos_axis - 1j * sin_axis * pm_vect)
    np.copyto(state, new_state)
658931
def _compute(self, feed_dict, shard):
        

        try:
            descriptor, enq = self._tfrun(self._tf_expr[shard], feed_dict=feed_dict)
            self._inputs_waiting.decrement(shard)

        except Exception as e:
            montblanc.log.exception("Compute Exception")
            raise
700722
def get_num_shards(num_samples: int, samples_per_shard: int, min_num_shards: int) -> int:
    
    return max(int(math.ceil(num_samples / samples_per_shard)), min_num_shards)
1096113
def push_state(self):
        

        new = dict(self.states[-1])
        self.states.append(new)
        return self.state
430241
def get_next_input(self):
        

        # TODO: could override input if we get input coming in at the same time
        all_input = Deployment.objects.get(pk=self.id).input or ''
        lines = all_input.splitlines()
        first_line = lines[0] if len(lines) else None
        lines = lines[1:] if len(lines) > 1 else []
        Deployment.objects.filter(pk=self.id).update(input='\n'.join(lines))
        return first_line
1349488
def is_in_shard(self, s):
    
    return self.compute_shard(s, self._nshards) == self._shard
1061976
def create_new(cls, mapreduce_id, shard_number):
    
    shard_id = cls.shard_id_from_number(mapreduce_id, shard_number)
    state = cls(key_name=shard_id,
                mapreduce_id=mapreduce_id)
    return state
903747
@PublicEvolving
	@Override
	public Tuple2<Long, Long> getCurrentState() throws IOException {
		if (this.blockBasedInput == null) {
			throw new RuntimeException("You must have forgotten to call open() on your input format.");
		}

		return  new Tuple2<>(
			this.blockBasedInput.getCurrBlockPos(), 		// the last read index in the block
			this.readRecords								// the number of records read
		);
	}
119619
def state(self):
        '''

        '''
        return dict(a=self.a.tolist(), b=self.b.tolist(), c=self.c.tolist(),
                    pivot=self.pivot.tolist(), position=self.position.tolist())
339522
def get_shard_map(self, force_refresh=False):
        
        now = datetime.utcnow()
        if force_refresh is True or \
                        self.shard_map is None or \
                        (now - self.last_refresh).total_seconds() > self.refresh_ttl:
            self.last_refresh = now
            self.refresh_shard_map()
        return self.shard_map
513199
def Deserialize(self, reader):
        
        super(AccountState, self).Deserialize(reader)
        self.ScriptHash = reader.ReadUInt160()
        self.IsFrozen = reader.ReadBool()
        num_votes = reader.ReadVarInt()
        for i in range(0, num_votes):
            self.Votes.append(reader.ReadBytes(33))

        num_balances = reader.ReadVarInt()
        self.Balances = {}
        for i in range(0, num_balances):
            assetid = reader.ReadUInt256()
            amount = reader.ReadFixed8()
            self.Balances[assetid] = amount
846825
def unseal(shard)
      json = client.put("/v1/sys/unseal", JSON.fast_generate(
        key: shard,
      ))
      return SealStatus.decode(json)
    end
319534
def getstate(d):
    '''
    '''
    if not isinstance(d, dict):
        raise TypeError("Can only get the state of a dictionary")
    cpd = copy.deepcopy(d)
    cpd.pop('_links', None)
    cpd.pop('_embedded', None)
    return cpd
691662
public int registerNewSubscribedShardState(KinesisStreamShardState newSubscribedShardState) {
		synchronized (checkpointLock) {
			subscribedShardsState.add(newSubscribedShardState);

			// If a registered shard has initial state that is not SENTINEL_SHARD_ENDING_SEQUENCE_NUM (will be the case
			// if the consumer had already finished reading a shard before we failed and restored), we determine that
			// this subtask has a new active shard
			if (!newSubscribedShardState.getLastProcessedSequenceNum().equals(SentinelSequenceNumber.SENTINEL_SHARD_ENDING_SEQUENCE_NUM.get())) {
				this.numberOfActiveShards.incrementAndGet();
			}

			int shardStateIndex = subscribedShardsState.size() - 1;

			// track all discovered shards for watermark determination
			ShardWatermarkState sws = shardWatermarks.get(shardStateIndex);
			if (sws == null) {
				sws = new ShardWatermarkState();
				try {
					sws.periodicWatermarkAssigner = InstantiationUtil.clone(periodicWatermarkAssigner);
				} catch (Exception e) {
					throw new RuntimeException("Failed to instantiate new WatermarkAssigner", e);
				}
				sws.lastUpdated = getCurrentTimeMillis();
				sws.lastRecordTimestamp = Long.MIN_VALUE;
				shardWatermarks.put(shardStateIndex, sws);
			}

			return shardStateIndex;
		}
	}