repo
stringlengths
7
54
path
stringlengths
4
223
func_name
stringlengths
1
134
original_string
stringlengths
75
104k
language
stringclasses
1 value
code
stringlengths
75
104k
code_tokens
listlengths
20
28.4k
docstring
stringlengths
1
46.3k
docstring_tokens
listlengths
1
1.66k
sha
stringlengths
40
40
url
stringlengths
87
315
partition
stringclasses
1 value
summary
stringlengths
4
350
obf_code
stringlengths
7.85k
764k
dnanexus/dx-toolkit
src/python/dxpy/utils/spelling_corrector.py
correct
def correct(word, known_words): """ :param word: Word to correct :type word: string :param known_words: List of known words :type known_words: iterable of strings Given **word**, suggests a correction from **known_words**. If no reasonably close correction is found, returns **word**. ""...
python
def correct(word, known_words): """ :param word: Word to correct :type word: string :param known_words: List of known words :type known_words: iterable of strings Given **word**, suggests a correction from **known_words**. If no reasonably close correction is found, returns **word**. ""...
[ "def", "correct", "(", "word", ",", "known_words", ")", ":", "NWORDS", "=", "_train", "(", "known_words", ")", "candidates", "=", "_known", "(", "[", "word", "]", ",", "NWORDS", ")", "or", "_known", "(", "_edits1", "(", "word", ")", ",", "NWORDS", ")...
:param word: Word to correct :type word: string :param known_words: List of known words :type known_words: iterable of strings Given **word**, suggests a correction from **known_words**. If no reasonably close correction is found, returns **word**.
[ ":", "param", "word", ":", "Word", "to", "correct", ":", "type", "word", ":", "string", ":", "param", "known_words", ":", "List", "of", "known", "words", ":", "type", "known_words", ":", "iterable", "of", "strings" ]
74befb53ad90fcf902d8983ae6d74580f402d619
https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/utils/spelling_corrector.py#L47-L59
train
Returns the best fit of the given word in the given list of known words.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/api/map_job/model_datastore_input_reader.py
ModelDatastoreInputReader.split_input
def split_input(cls, job_config): """Inherit docs.""" params = job_config.input_reader_params shard_count = job_config.shard_count query_spec = cls._get_query_spec(params) if not property_range.should_shard_by_property_range(query_spec.filters): return super(ModelDatastoreInputReader, cls).sp...
python
def split_input(cls, job_config): """Inherit docs.""" params = job_config.input_reader_params shard_count = job_config.shard_count query_spec = cls._get_query_spec(params) if not property_range.should_shard_by_property_range(query_spec.filters): return super(ModelDatastoreInputReader, cls).sp...
[ "def", "split_input", "(", "cls", ",", "job_config", ")", ":", "params", "=", "job_config", ".", "input_reader_params", "shard_count", "=", "job_config", ".", "shard_count", "query_spec", "=", "cls", ".", "_get_query_spec", "(", "params", ")", "if", "not", "pr...
Inherit docs.
[ "Inherit", "docs", "." ]
2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/api/map_job/model_datastore_input_reader.py#L53-L96
train
Inherit docs.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/api/map_job/model_datastore_input_reader.py
ModelDatastoreInputReader.validate
def validate(cls, job_config): """Inherit docs.""" super(ModelDatastoreInputReader, cls).validate(job_config) params = job_config.input_reader_params entity_kind = params[cls.ENTITY_KIND_PARAM] # Fail fast if Model cannot be located. try: model_class = util.for_name(entity_kind) except...
python
def validate(cls, job_config): """Inherit docs.""" super(ModelDatastoreInputReader, cls).validate(job_config) params = job_config.input_reader_params entity_kind = params[cls.ENTITY_KIND_PARAM] # Fail fast if Model cannot be located. try: model_class = util.for_name(entity_kind) except...
[ "def", "validate", "(", "cls", ",", "job_config", ")", ":", "super", "(", "ModelDatastoreInputReader", ",", "cls", ")", ".", "validate", "(", "job_config", ")", "params", "=", "job_config", ".", "input_reader_params", "entity_kind", "=", "params", "[", "cls", ...
Inherit docs.
[ "Inherit", "docs", "." ]
2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/api/map_job/model_datastore_input_reader.py#L99-L115
train
Inherit docs.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/api/map_job/model_datastore_input_reader.py
ModelDatastoreInputReader._validate_filters
def _validate_filters(cls, filters, model_class): """Validate user supplied filters. Validate filters are on existing properties and filter values have valid semantics. Args: filters: user supplied filters. Each filter should be a list or tuple of format (<property_name_as_str>, <query_o...
python
def _validate_filters(cls, filters, model_class): """Validate user supplied filters. Validate filters are on existing properties and filter values have valid semantics. Args: filters: user supplied filters. Each filter should be a list or tuple of format (<property_name_as_str>, <query_o...
[ "def", "_validate_filters", "(", "cls", ",", "filters", ",", "model_class", ")", ":", "if", "not", "filters", ":", "return", "properties", "=", "model_class", ".", "properties", "(", ")", "for", "f", "in", "filters", ":", "prop", ",", "_", ",", "val", ...
Validate user supplied filters. Validate filters are on existing properties and filter values have valid semantics. Args: filters: user supplied filters. Each filter should be a list or tuple of format (<property_name_as_str>, <query_operator_as_str>, <value_of_certain_type>). Value ...
[ "Validate", "user", "supplied", "filters", "." ]
2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/api/map_job/model_datastore_input_reader.py#L118-L150
train
Validate user supplied filters.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/api/map_job/model_datastore_input_reader.py
ModelDatastoreInputReader._validate_filters_ndb
def _validate_filters_ndb(cls, filters, model_class): """Validate ndb.Model filters.""" if not filters: return properties = model_class._properties for f in filters: prop, _, val = f if prop not in properties: raise errors.BadReaderParamsError( "Property %s is not...
python
def _validate_filters_ndb(cls, filters, model_class): """Validate ndb.Model filters.""" if not filters: return properties = model_class._properties for f in filters: prop, _, val = f if prop not in properties: raise errors.BadReaderParamsError( "Property %s is not...
[ "def", "_validate_filters_ndb", "(", "cls", ",", "filters", ",", "model_class", ")", ":", "if", "not", "filters", ":", "return", "properties", "=", "model_class", ".", "_properties", "for", "f", "in", "filters", ":", "prop", ",", "_", ",", "val", "=", "f...
Validate ndb.Model filters.
[ "Validate", "ndb", ".", "Model", "filters", "." ]
2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/api/map_job/model_datastore_input_reader.py#L154-L173
train
Validate ndb. Model filters.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/context.py
_normalize_entity
def _normalize_entity(value): """Return an entity from an entity or model instance.""" if ndb is not None and isinstance(value, ndb.Model): return None if getattr(value, "_populate_internal_entity", None): return value._populate_internal_entity() return value
python
def _normalize_entity(value): """Return an entity from an entity or model instance.""" if ndb is not None and isinstance(value, ndb.Model): return None if getattr(value, "_populate_internal_entity", None): return value._populate_internal_entity() return value
[ "def", "_normalize_entity", "(", "value", ")", ":", "if", "ndb", "is", "not", "None", "and", "isinstance", "(", "value", ",", "ndb", ".", "Model", ")", ":", "return", "None", "if", "getattr", "(", "value", ",", "\"_populate_internal_entity\"", ",", "None",...
Return an entity from an entity or model instance.
[ "Return", "an", "entity", "from", "an", "entity", "or", "model", "instance", "." ]
2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/context.py#L71-L77
train
Return an entity from an entity or model instance.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/context.py
_normalize_key
def _normalize_key(value): """Return a key from an entity, model instance, key, or key string.""" if ndb is not None and isinstance(value, (ndb.Model, ndb.Key)): return None if getattr(value, "key", None): return value.key() elif isinstance(value, basestring): return datastore.Key(value) else: ...
python
def _normalize_key(value): """Return a key from an entity, model instance, key, or key string.""" if ndb is not None and isinstance(value, (ndb.Model, ndb.Key)): return None if getattr(value, "key", None): return value.key() elif isinstance(value, basestring): return datastore.Key(value) else: ...
[ "def", "_normalize_key", "(", "value", ")", ":", "if", "ndb", "is", "not", "None", "and", "isinstance", "(", "value", ",", "(", "ndb", ".", "Model", ",", "ndb", ".", "Key", ")", ")", ":", "return", "None", "if", "getattr", "(", "value", ",", "\"key...
Return a key from an entity, model instance, key, or key string.
[ "Return", "a", "key", "from", "an", "entity", "model", "instance", "key", "or", "key", "string", "." ]
2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/context.py#L80-L89
train
Return a key from an entity model instance key or key string.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/context.py
_ItemList.append
def append(self, item): """Add new item to the list. If needed, append will first flush existing items and clear existing items. Args: item: an item to add to the list. """ if self.should_flush(): self.flush() self.items.append(item)
python
def append(self, item): """Add new item to the list. If needed, append will first flush existing items and clear existing items. Args: item: an item to add to the list. """ if self.should_flush(): self.flush() self.items.append(item)
[ "def", "append", "(", "self", ",", "item", ")", ":", "if", "self", ".", "should_flush", "(", ")", ":", "self", ".", "flush", "(", ")", "self", ".", "items", ".", "append", "(", "item", ")" ]
Add new item to the list. If needed, append will first flush existing items and clear existing items. Args: item: an item to add to the list.
[ "Add", "new", "item", "to", "the", "list", "." ]
2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/context.py#L133-L143
train
Adds a new item to the list. If needed flush existing items and clear existing items.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/context.py
_ItemList.flush
def flush(self): """Force a flush.""" if not self.items: return retry = 0 options = {"deadline": DATASTORE_DEADLINE} while retry <= self.__timeout_retries: try: self.__flush_function(self.items, options) self.clear() break except db.Timeout, e: logg...
python
def flush(self): """Force a flush.""" if not self.items: return retry = 0 options = {"deadline": DATASTORE_DEADLINE} while retry <= self.__timeout_retries: try: self.__flush_function(self.items, options) self.clear() break except db.Timeout, e: logg...
[ "def", "flush", "(", "self", ")", ":", "if", "not", "self", ".", "items", ":", "return", "retry", "=", "0", "options", "=", "{", "\"deadline\"", ":", "DATASTORE_DEADLINE", "}", "while", "retry", "<=", "self", ".", "__timeout_retries", ":", "try", ":", ...
Force a flush.
[ "Force", "a", "flush", "." ]
2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/context.py#L145-L167
train
Force a flush.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/context.py
_MutationPool.put
def put(self, entity): """Registers entity to put to datastore. Args: entity: an entity or model instance to put. """ actual_entity = _normalize_entity(entity) if actual_entity is None: return self.ndb_put(entity) self.puts.append(actual_entity)
python
def put(self, entity): """Registers entity to put to datastore. Args: entity: an entity or model instance to put. """ actual_entity = _normalize_entity(entity) if actual_entity is None: return self.ndb_put(entity) self.puts.append(actual_entity)
[ "def", "put", "(", "self", ",", "entity", ")", ":", "actual_entity", "=", "_normalize_entity", "(", "entity", ")", "if", "actual_entity", "is", "None", ":", "return", "self", ".", "ndb_put", "(", "entity", ")", "self", ".", "puts", ".", "append", "(", ...
Registers entity to put to datastore. Args: entity: an entity or model instance to put.
[ "Registers", "entity", "to", "put", "to", "datastore", "." ]
2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/context.py#L249-L258
train
Registers entity to datastore.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/context.py
_MutationPool.ndb_put
def ndb_put(self, entity): """Like put(), but for NDB entities.""" assert ndb is not None and isinstance(entity, ndb.Model) self.ndb_puts.append(entity)
python
def ndb_put(self, entity): """Like put(), but for NDB entities.""" assert ndb is not None and isinstance(entity, ndb.Model) self.ndb_puts.append(entity)
[ "def", "ndb_put", "(", "self", ",", "entity", ")", ":", "assert", "ndb", "is", "not", "None", "and", "isinstance", "(", "entity", ",", "ndb", ".", "Model", ")", "self", ".", "ndb_puts", ".", "append", "(", "entity", ")" ]
Like put(), but for NDB entities.
[ "Like", "put", "()", "but", "for", "NDB", "entities", "." ]
2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/context.py#L260-L263
train
Like put but for NDB entities.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/context.py
_MutationPool.delete
def delete(self, entity): """Registers entity to delete from datastore. Args: entity: an entity, model instance, or key to delete. """ key = _normalize_key(entity) if key is None: return self.ndb_delete(entity) self.deletes.append(key)
python
def delete(self, entity): """Registers entity to delete from datastore. Args: entity: an entity, model instance, or key to delete. """ key = _normalize_key(entity) if key is None: return self.ndb_delete(entity) self.deletes.append(key)
[ "def", "delete", "(", "self", ",", "entity", ")", ":", "key", "=", "_normalize_key", "(", "entity", ")", "if", "key", "is", "None", ":", "return", "self", ".", "ndb_delete", "(", "entity", ")", "self", ".", "deletes", ".", "append", "(", "key", ")" ]
Registers entity to delete from datastore. Args: entity: an entity, model instance, or key to delete.
[ "Registers", "entity", "to", "delete", "from", "datastore", "." ]
2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/context.py#L265-L274
train
Registers entity to be deleted from datastore.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/context.py
_MutationPool.ndb_delete
def ndb_delete(self, entity_or_key): """Like delete(), but for NDB entities/keys.""" if ndb is not None and isinstance(entity_or_key, ndb.Model): key = entity_or_key.key else: key = entity_or_key self.ndb_deletes.append(key)
python
def ndb_delete(self, entity_or_key): """Like delete(), but for NDB entities/keys.""" if ndb is not None and isinstance(entity_or_key, ndb.Model): key = entity_or_key.key else: key = entity_or_key self.ndb_deletes.append(key)
[ "def", "ndb_delete", "(", "self", ",", "entity_or_key", ")", ":", "if", "ndb", "is", "not", "None", "and", "isinstance", "(", "entity_or_key", ",", "ndb", ".", "Model", ")", ":", "key", "=", "entity_or_key", ".", "key", "else", ":", "key", "=", "entity...
Like delete(), but for NDB entities/keys.
[ "Like", "delete", "()", "but", "for", "NDB", "entities", "/", "keys", "." ]
2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/context.py#L276-L282
train
Like delete but for NDB entities and keys.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/context.py
_MutationPool.flush
def flush(self): """Flush(apply) all changed to datastore.""" self.puts.flush() self.deletes.flush() self.ndb_puts.flush() self.ndb_deletes.flush()
python
def flush(self): """Flush(apply) all changed to datastore.""" self.puts.flush() self.deletes.flush() self.ndb_puts.flush() self.ndb_deletes.flush()
[ "def", "flush", "(", "self", ")", ":", "self", ".", "puts", ".", "flush", "(", ")", "self", ".", "deletes", ".", "flush", "(", ")", "self", ".", "ndb_puts", ".", "flush", "(", ")", "self", ".", "ndb_deletes", ".", "flush", "(", ")" ]
Flush(apply) all changed to datastore.
[ "Flush", "(", "apply", ")", "all", "changed", "to", "datastore", "." ]
2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/context.py#L284-L289
train
Flush all changed to datastore.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/context.py
_MutationPool._flush_puts
def _flush_puts(self, items, options): """Flush all puts to datastore.""" datastore.Put(items, config=self._create_config(options))
python
def _flush_puts(self, items, options): """Flush all puts to datastore.""" datastore.Put(items, config=self._create_config(options))
[ "def", "_flush_puts", "(", "self", ",", "items", ",", "options", ")", ":", "datastore", ".", "Put", "(", "items", ",", "config", "=", "self", ".", "_create_config", "(", "options", ")", ")" ]
Flush all puts to datastore.
[ "Flush", "all", "puts", "to", "datastore", "." ]
2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/context.py#L315-L317
train
Flushes all puts to datastore.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/context.py
_MutationPool._flush_deletes
def _flush_deletes(self, items, options): """Flush all deletes to datastore.""" datastore.Delete(items, config=self._create_config(options))
python
def _flush_deletes(self, items, options): """Flush all deletes to datastore.""" datastore.Delete(items, config=self._create_config(options))
[ "def", "_flush_deletes", "(", "self", ",", "items", ",", "options", ")", ":", "datastore", ".", "Delete", "(", "items", ",", "config", "=", "self", ".", "_create_config", "(", "options", ")", ")" ]
Flush all deletes to datastore.
[ "Flush", "all", "deletes", "to", "datastore", "." ]
2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/context.py#L319-L321
train
Flush all deletes to datastore.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/context.py
_MutationPool._flush_ndb_puts
def _flush_ndb_puts(self, items, options): """Flush all NDB puts to datastore.""" assert ndb is not None ndb.put_multi(items, config=self._create_config(options))
python
def _flush_ndb_puts(self, items, options): """Flush all NDB puts to datastore.""" assert ndb is not None ndb.put_multi(items, config=self._create_config(options))
[ "def", "_flush_ndb_puts", "(", "self", ",", "items", ",", "options", ")", ":", "assert", "ndb", "is", "not", "None", "ndb", ".", "put_multi", "(", "items", ",", "config", "=", "self", ".", "_create_config", "(", "options", ")", ")" ]
Flush all NDB puts to datastore.
[ "Flush", "all", "NDB", "puts", "to", "datastore", "." ]
2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/context.py#L323-L326
train
Flush all NDB puts to datastore.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/context.py
_MutationPool._flush_ndb_deletes
def _flush_ndb_deletes(self, items, options): """Flush all deletes to datastore.""" assert ndb is not None ndb.delete_multi(items, config=self._create_config(options))
python
def _flush_ndb_deletes(self, items, options): """Flush all deletes to datastore.""" assert ndb is not None ndb.delete_multi(items, config=self._create_config(options))
[ "def", "_flush_ndb_deletes", "(", "self", ",", "items", ",", "options", ")", ":", "assert", "ndb", "is", "not", "None", "ndb", ".", "delete_multi", "(", "items", ",", "config", "=", "self", ".", "_create_config", "(", "options", ")", ")" ]
Flush all deletes to datastore.
[ "Flush", "all", "deletes", "to", "datastore", "." ]
2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/context.py#L328-L331
train
Flush all deletes to datastore.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/context.py
_MutationPool._create_config
def _create_config(self, options): """Creates datastore Config. Returns: A datastore_rpc.Configuration instance. """ return datastore.CreateConfig(deadline=options["deadline"], force_writes=self.force_writes)
python
def _create_config(self, options): """Creates datastore Config. Returns: A datastore_rpc.Configuration instance. """ return datastore.CreateConfig(deadline=options["deadline"], force_writes=self.force_writes)
[ "def", "_create_config", "(", "self", ",", "options", ")", ":", "return", "datastore", ".", "CreateConfig", "(", "deadline", "=", "options", "[", "\"deadline\"", "]", ",", "force_writes", "=", "self", ".", "force_writes", ")" ]
Creates datastore Config. Returns: A datastore_rpc.Configuration instance.
[ "Creates", "datastore", "Config", "." ]
2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/context.py#L333-L340
train
Creates a datastore Config.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/context.py
_Counters.increment
def increment(self, counter_name, delta=1): """Increment counter value. Args: counter_name: name of the counter as string. delta: increment delta as int. """ self._shard_state.counters_map.increment(counter_name, delta)
python
def increment(self, counter_name, delta=1): """Increment counter value. Args: counter_name: name of the counter as string. delta: increment delta as int. """ self._shard_state.counters_map.increment(counter_name, delta)
[ "def", "increment", "(", "self", ",", "counter_name", ",", "delta", "=", "1", ")", ":", "self", ".", "_shard_state", ".", "counters_map", ".", "increment", "(", "counter_name", ",", "delta", ")" ]
Increment counter value. Args: counter_name: name of the counter as string. delta: increment delta as int.
[ "Increment", "counter", "value", "." ]
2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/context.py#L358-L365
train
Increment the value of a counter.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/datastore_range_iterators.py
_PropertyRangeModelIterator.to_json
def to_json(self): """Inherit doc.""" cursor = self._cursor if self._query is not None: if isinstance(self._query, db.Query): cursor = self._query.cursor() else: cursor = self._query.cursor_after() if cursor is None or isinstance(cursor, basestring): cursor_object = Fa...
python
def to_json(self): """Inherit doc.""" cursor = self._cursor if self._query is not None: if isinstance(self._query, db.Query): cursor = self._query.cursor() else: cursor = self._query.cursor_after() if cursor is None or isinstance(cursor, basestring): cursor_object = Fa...
[ "def", "to_json", "(", "self", ")", ":", "cursor", "=", "self", ".", "_cursor", "if", "self", ".", "_query", "is", "not", "None", ":", "if", "isinstance", "(", "self", ".", "_query", ",", "db", ".", "Query", ")", ":", "cursor", "=", "self", ".", ...
Inherit doc.
[ "Inherit", "doc", "." ]
2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/datastore_range_iterators.py#L195-L215
train
Inherit doc.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/datastore_range_iterators.py
_PropertyRangeModelIterator.from_json
def from_json(cls, json): """Inherit doc.""" obj = cls(property_range.PropertyRange.from_json(json["property_range"]), namespace_range.NamespaceRange.from_json_object(json["ns_range"]), model.QuerySpec.from_json(json["query_spec"])) cursor = json["cursor"] # lint bug. Class m...
python
def from_json(cls, json): """Inherit doc.""" obj = cls(property_range.PropertyRange.from_json(json["property_range"]), namespace_range.NamespaceRange.from_json_object(json["ns_range"]), model.QuerySpec.from_json(json["query_spec"])) cursor = json["cursor"] # lint bug. Class m...
[ "def", "from_json", "(", "cls", ",", "json", ")", ":", "obj", "=", "cls", "(", "property_range", ".", "PropertyRange", ".", "from_json", "(", "json", "[", "\"property_range\"", "]", ")", ",", "namespace_range", ".", "NamespaceRange", ".", "from_json_object", ...
Inherit doc.
[ "Inherit", "doc", "." ]
2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/datastore_range_iterators.py#L222-L234
train
Inherit doc.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/datastore_range_iterators.py
_MultiPropertyRangeModelIterator.to_json
def to_json(self): """Inherit doc.""" json = {"name": self.__class__.__name__, "num_ranges": len(self._iters)} for i in xrange(len(self._iters)): json_item = self._iters[i].to_json() query_spec = json_item["query_spec"] item_name = json_item["name"] # Delete and move one...
python
def to_json(self): """Inherit doc.""" json = {"name": self.__class__.__name__, "num_ranges": len(self._iters)} for i in xrange(len(self._iters)): json_item = self._iters[i].to_json() query_spec = json_item["query_spec"] item_name = json_item["name"] # Delete and move one...
[ "def", "to_json", "(", "self", ")", ":", "json", "=", "{", "\"name\"", ":", "self", ".", "__class__", ".", "__name__", ",", "\"num_ranges\"", ":", "len", "(", "self", ".", "_iters", ")", "}", "for", "i", "in", "xrange", "(", "len", "(", "self", "."...
Inherit doc.
[ "Inherit", "doc", "." ]
2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/datastore_range_iterators.py#L262-L279
train
Inherit doc.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/datastore_range_iterators.py
_MultiPropertyRangeModelIterator.from_json
def from_json(cls, json): """Inherit doc.""" num_ranges = int(json["num_ranges"]) query_spec = json["query_spec"] item_name = json["item_name"] p_range_iters = [] for i in xrange(num_ranges): json_item = json[str(i)] # Place query_spec, name back into each iterator json_item["...
python
def from_json(cls, json): """Inherit doc.""" num_ranges = int(json["num_ranges"]) query_spec = json["query_spec"] item_name = json["item_name"] p_range_iters = [] for i in xrange(num_ranges): json_item = json[str(i)] # Place query_spec, name back into each iterator json_item["...
[ "def", "from_json", "(", "cls", ",", "json", ")", ":", "num_ranges", "=", "int", "(", "json", "[", "\"num_ranges\"", "]", ")", "query_spec", "=", "json", "[", "\"query_spec\"", "]", "item_name", "=", "json", "[", "\"item_name\"", "]", "p_range_iters", "=",...
Inherit doc.
[ "Inherit", "doc", "." ]
2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/datastore_range_iterators.py#L282-L297
train
Inherit doc.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/datastore_range_iterators.py
_KeyRangesIterator.to_json
def to_json(self): """Inherit doc.""" current_iter = None if self._current_iter: current_iter = self._current_iter.to_json() return {"key_ranges": self._key_ranges.to_json(), "query_spec": self._query_spec.to_json(), "current_iter": current_iter, "key_range_ite...
python
def to_json(self): """Inherit doc.""" current_iter = None if self._current_iter: current_iter = self._current_iter.to_json() return {"key_ranges": self._key_ranges.to_json(), "query_spec": self._query_spec.to_json(), "current_iter": current_iter, "key_range_ite...
[ "def", "to_json", "(", "self", ")", ":", "current_iter", "=", "None", "if", "self", ".", "_current_iter", ":", "current_iter", "=", "self", ".", "_current_iter", ".", "to_json", "(", ")", "return", "{", "\"key_ranges\"", ":", "self", ".", "_key_ranges", "....
Inherit doc.
[ "Inherit", "doc", "." ]
2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/datastore_range_iterators.py#L339-L349
train
Inherit doc.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/datastore_range_iterators.py
_KeyRangesIterator.from_json
def from_json(cls, json): """Inherit doc.""" key_range_iter_cls = _KEY_RANGE_ITERATORS[json["key_range_iter_cls"]] obj = cls(key_ranges.KeyRangesFactory.from_json(json["key_ranges"]), model.QuerySpec.from_json(json["query_spec"]), key_range_iter_cls) current_iter = None ...
python
def from_json(cls, json): """Inherit doc.""" key_range_iter_cls = _KEY_RANGE_ITERATORS[json["key_range_iter_cls"]] obj = cls(key_ranges.KeyRangesFactory.from_json(json["key_ranges"]), model.QuerySpec.from_json(json["query_spec"]), key_range_iter_cls) current_iter = None ...
[ "def", "from_json", "(", "cls", ",", "json", ")", ":", "key_range_iter_cls", "=", "_KEY_RANGE_ITERATORS", "[", "json", "[", "\"key_range_iter_cls\"", "]", "]", "obj", "=", "cls", "(", "key_ranges", ".", "KeyRangesFactory", ".", "from_json", "(", "json", "[", ...
Inherit doc.
[ "Inherit", "doc", "." ]
2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/datastore_range_iterators.py#L352-L364
train
Inherit doc.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/datastore_range_iterators.py
AbstractKeyRangeIterator.to_json
def to_json(self): """Serializes all states into json form. Returns: all states in json-compatible map. """ cursor = self._get_cursor() cursor_object = False if cursor and isinstance(cursor, datastore_query.Cursor): cursor = cursor.to_websafe_string() cursor_object = True ...
python
def to_json(self): """Serializes all states into json form. Returns: all states in json-compatible map. """ cursor = self._get_cursor() cursor_object = False if cursor and isinstance(cursor, datastore_query.Cursor): cursor = cursor.to_websafe_string() cursor_object = True ...
[ "def", "to_json", "(", "self", ")", ":", "cursor", "=", "self", ".", "_get_cursor", "(", ")", "cursor_object", "=", "False", "if", "cursor", "and", "isinstance", "(", "cursor", ",", "datastore_query", ".", "Cursor", ")", ":", "cursor", "=", "cursor", "."...
Serializes all states into json form. Returns: all states in json-compatible map.
[ "Serializes", "all", "states", "into", "json", "form", "." ]
2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/datastore_range_iterators.py#L405-L419
train
Serializes all states into json form.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/datastore_range_iterators.py
AbstractKeyRangeIterator.from_json
def from_json(cls, json): """Reverse of to_json.""" obj = cls(key_range.KeyRange.from_json(json["key_range"]), model.QuerySpec.from_json(json["query_spec"])) cursor = json["cursor"] # lint bug. Class method can access protected fields. # pylint: disable=protected-access if cursor a...
python
def from_json(cls, json): """Reverse of to_json.""" obj = cls(key_range.KeyRange.from_json(json["key_range"]), model.QuerySpec.from_json(json["query_spec"])) cursor = json["cursor"] # lint bug. Class method can access protected fields. # pylint: disable=protected-access if cursor a...
[ "def", "from_json", "(", "cls", ",", "json", ")", ":", "obj", "=", "cls", "(", "key_range", ".", "KeyRange", ".", "from_json", "(", "json", "[", "\"key_range\"", "]", ")", ",", "model", ".", "QuerySpec", ".", "from_json", "(", "json", "[", "\"query_spe...
Reverse of to_json.
[ "Reverse", "of", "to_json", "." ]
2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/datastore_range_iterators.py#L422-L433
train
Reverse of to_json.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/status.py
find_mapreduce_yaml
def find_mapreduce_yaml(status_file=__file__): """Traverse directory trees to find mapreduce.yaml file. Begins with the location of status.py and then moves on to check the working directory. Args: status_file: location of status.py, overridable for testing purposes. Returns: the path of mapreduce....
python
def find_mapreduce_yaml(status_file=__file__): """Traverse directory trees to find mapreduce.yaml file. Begins with the location of status.py and then moves on to check the working directory. Args: status_file: location of status.py, overridable for testing purposes. Returns: the path of mapreduce....
[ "def", "find_mapreduce_yaml", "(", "status_file", "=", "__file__", ")", ":", "checked", "=", "set", "(", ")", "yaml", "=", "_find_mapreduce_yaml", "(", "os", ".", "path", ".", "dirname", "(", "status_file", ")", ",", "checked", ")", "if", "not", "yaml", ...
Traverse directory trees to find mapreduce.yaml file. Begins with the location of status.py and then moves on to check the working directory. Args: status_file: location of status.py, overridable for testing purposes. Returns: the path of mapreduce.yaml file or None if not found.
[ "Traverse", "directory", "trees", "to", "find", "mapreduce", ".", "yaml", "file", "." ]
2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/status.py#L161-L177
train
Traverse the directory trees to find mapreduce. yaml file.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/status.py
_find_mapreduce_yaml
def _find_mapreduce_yaml(start, checked): """Traverse the directory tree identified by start until a directory already in checked is encountered or the path of mapreduce.yaml is found. Checked is present both to make loop termination easy to reason about and so that the same directories do not get rechecked. ...
python
def _find_mapreduce_yaml(start, checked): """Traverse the directory tree identified by start until a directory already in checked is encountered or the path of mapreduce.yaml is found. Checked is present both to make loop termination easy to reason about and so that the same directories do not get rechecked. ...
[ "def", "_find_mapreduce_yaml", "(", "start", ",", "checked", ")", ":", "dir", "=", "start", "while", "dir", "not", "in", "checked", ":", "checked", ".", "add", "(", "dir", ")", "for", "mr_yaml_name", "in", "MR_YAML_NAMES", ":", "yaml_path", "=", "os", "....
Traverse the directory tree identified by start until a directory already in checked is encountered or the path of mapreduce.yaml is found. Checked is present both to make loop termination easy to reason about and so that the same directories do not get rechecked. Args: start: the path to start in and wor...
[ "Traverse", "the", "directory", "tree", "identified", "by", "start", "until", "a", "directory", "already", "in", "checked", "is", "encountered", "or", "the", "path", "of", "mapreduce", ".", "yaml", "is", "found", "." ]
2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/status.py#L180-L202
train
Traverse the directory tree identified by start until a directory already in checked is encountered.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/status.py
parse_mapreduce_yaml
def parse_mapreduce_yaml(contents): """Parses mapreduce.yaml file contents. Args: contents: mapreduce.yaml file contents. Returns: MapReduceYaml object with all the data from original file. Raises: errors.BadYamlError: when contents is not a valid mapreduce.yaml file. """ try: builder = y...
python
def parse_mapreduce_yaml(contents): """Parses mapreduce.yaml file contents. Args: contents: mapreduce.yaml file contents. Returns: MapReduceYaml object with all the data from original file. Raises: errors.BadYamlError: when contents is not a valid mapreduce.yaml file. """ try: builder = y...
[ "def", "parse_mapreduce_yaml", "(", "contents", ")", ":", "try", ":", "builder", "=", "yaml_object", ".", "ObjectBuilder", "(", "MapReduceYaml", ")", "handler", "=", "yaml_builder", ".", "BuilderHandler", "(", "builder", ")", "listener", "=", "yaml_listener", "....
Parses mapreduce.yaml file contents. Args: contents: mapreduce.yaml file contents. Returns: MapReduceYaml object with all the data from original file. Raises: errors.BadYamlError: when contents is not a valid mapreduce.yaml file.
[ "Parses", "mapreduce", ".", "yaml", "file", "contents", "." ]
2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/status.py#L205-L239
train
Parses mapreduce. yaml file contents. returns a new object with all the data from original file.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/status.py
get_mapreduce_yaml
def get_mapreduce_yaml(parse=parse_mapreduce_yaml): """Locates mapreduce.yaml, loads and parses its info. Args: parse: Used for testing. Returns: MapReduceYaml object. Raises: errors.BadYamlError: when contents is not a valid mapreduce.yaml file or the file is missing. """ mr_yaml_path = ...
python
def get_mapreduce_yaml(parse=parse_mapreduce_yaml): """Locates mapreduce.yaml, loads and parses its info. Args: parse: Used for testing. Returns: MapReduceYaml object. Raises: errors.BadYamlError: when contents is not a valid mapreduce.yaml file or the file is missing. """ mr_yaml_path = ...
[ "def", "get_mapreduce_yaml", "(", "parse", "=", "parse_mapreduce_yaml", ")", ":", "mr_yaml_path", "=", "find_mapreduce_yaml", "(", ")", "if", "not", "mr_yaml_path", ":", "raise", "errors", ".", "MissingYamlError", "(", ")", "mr_yaml_file", "=", "open", "(", "mr_...
Locates mapreduce.yaml, loads and parses its info. Args: parse: Used for testing. Returns: MapReduceYaml object. Raises: errors.BadYamlError: when contents is not a valid mapreduce.yaml file or the file is missing.
[ "Locates", "mapreduce", ".", "yaml", "loads", "and", "parses", "its", "info", "." ]
2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/status.py#L242-L262
train
Locates mapreduce. yaml loads and parses its info.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/status.py
MapReduceYaml.to_dict
def to_dict(mapreduce_yaml): """Converts a MapReduceYaml file into a JSON-encodable dictionary. For use in user-visible UI and internal methods for interfacing with user code (like param validation). as a list Args: mapreduce_yaml: The Pyton representation of the mapreduce.yaml document. Re...
python
def to_dict(mapreduce_yaml): """Converts a MapReduceYaml file into a JSON-encodable dictionary. For use in user-visible UI and internal methods for interfacing with user code (like param validation). as a list Args: mapreduce_yaml: The Pyton representation of the mapreduce.yaml document. Re...
[ "def", "to_dict", "(", "mapreduce_yaml", ")", ":", "all_configs", "=", "[", "]", "for", "config", "in", "mapreduce_yaml", ".", "mapreduce", ":", "out", "=", "{", "\"name\"", ":", "config", ".", "name", ",", "\"mapper_input_reader\"", ":", "config", ".", "m...
Converts a MapReduceYaml file into a JSON-encodable dictionary. For use in user-visible UI and internal methods for interfacing with user code (like param validation). as a list Args: mapreduce_yaml: The Pyton representation of the mapreduce.yaml document. Returns: A list of configuration...
[ "Converts", "a", "MapReduceYaml", "file", "into", "a", "JSON", "-", "encodable", "dictionary", "." ]
2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/status.py#L120-L155
train
Converts a MapReduceYaml file into a JSON - encodable dictionary.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/api/map_job/input_reader.py
InputReader.validate
def validate(cls, job_config): """Validates relevant parameters. This method can validate fields which it deems relevant. Args: job_config: an instance of map_job.JobConfig. Raises: errors.BadReaderParamsError: required parameters are missing or invalid. """ if job_config.input_re...
python
def validate(cls, job_config): """Validates relevant parameters. This method can validate fields which it deems relevant. Args: job_config: an instance of map_job.JobConfig. Raises: errors.BadReaderParamsError: required parameters are missing or invalid. """ if job_config.input_re...
[ "def", "validate", "(", "cls", ",", "job_config", ")", ":", "if", "job_config", ".", "input_reader_cls", "!=", "cls", ":", "raise", "errors", ".", "BadReaderParamsError", "(", "\"Expect input reader class %r, got %r.\"", "%", "(", "cls", ",", "job_config", ".", ...
Validates relevant parameters. This method can validate fields which it deems relevant. Args: job_config: an instance of map_job.JobConfig. Raises: errors.BadReaderParamsError: required parameters are missing or invalid.
[ "Validates", "relevant", "parameters", "." ]
2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/api/map_job/input_reader.py#L104-L118
train
Validates relevant parameters.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/shuffler.py
_sort_records_map
def _sort_records_map(records): """Map function sorting records. Converts records to KeyValue protos, sorts them by key and writes them into new GCS file. Creates _OutputFile entity to record resulting file name. Args: records: list of records which are serialized KeyValue protos. """ ctx = context....
python
def _sort_records_map(records): """Map function sorting records. Converts records to KeyValue protos, sorts them by key and writes them into new GCS file. Creates _OutputFile entity to record resulting file name. Args: records: list of records which are serialized KeyValue protos. """ ctx = context....
[ "def", "_sort_records_map", "(", "records", ")", ":", "ctx", "=", "context", ".", "get", "(", ")", "l", "=", "len", "(", "records", ")", "key_records", "=", "[", "None", "]", "*", "l", "logging", ".", "debug", "(", "\"Parsing\"", ")", "for", "i", "...
Map function sorting records. Converts records to KeyValue protos, sorts them by key and writes them into new GCS file. Creates _OutputFile entity to record resulting file name. Args: records: list of records which are serialized KeyValue protos.
[ "Map", "function", "sorting", "records", "." ]
2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/shuffler.py#L124-L164
train
Map function sorting records.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/shuffler.py
_merge_map
def _merge_map(key, values, partial): """A map function used in merge phase. Stores (key, values) into KeyValues proto and yields its serialization. Args: key: values key. values: values themselves. partial: True if more values for this key will follow. False otherwise. Yields: The proto. "...
python
def _merge_map(key, values, partial): """A map function used in merge phase. Stores (key, values) into KeyValues proto and yields its serialization. Args: key: values key. values: values themselves. partial: True if more values for this key will follow. False otherwise. Yields: The proto. "...
[ "def", "_merge_map", "(", "key", ",", "values", ",", "partial", ")", ":", "proto", "=", "kv_pb", ".", "KeyValues", "(", ")", "proto", ".", "set_key", "(", "key", ")", "proto", ".", "value_list", "(", ")", ".", "extend", "(", "values", ")", "yield", ...
A map function used in merge phase. Stores (key, values) into KeyValues proto and yields its serialization. Args: key: values key. values: values themselves. partial: True if more values for this key will follow. False otherwise. Yields: The proto.
[ "A", "map", "function", "used", "in", "merge", "phase", "." ]
2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/shuffler.py#L561-L577
train
A map function used in merge phase.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/shuffler.py
_hashing_map
def _hashing_map(binary_record): """A map function used in hash phase. Reads KeyValue from binary record. Args: binary_record: The binary record. Yields: The (key, value). """ proto = kv_pb.KeyValue() proto.ParseFromString(binary_record) yield (proto.key(), proto.value())
python
def _hashing_map(binary_record): """A map function used in hash phase. Reads KeyValue from binary record. Args: binary_record: The binary record. Yields: The (key, value). """ proto = kv_pb.KeyValue() proto.ParseFromString(binary_record) yield (proto.key(), proto.value())
[ "def", "_hashing_map", "(", "binary_record", ")", ":", "proto", "=", "kv_pb", ".", "KeyValue", "(", ")", "proto", ".", "ParseFromString", "(", "binary_record", ")", "yield", "(", "proto", ".", "key", "(", ")", ",", "proto", ".", "value", "(", ")", ")" ...
A map function used in hash phase. Reads KeyValue from binary record. Args: binary_record: The binary record. Yields: The (key, value).
[ "A", "map", "function", "used", "in", "hash", "phase", "." ]
2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/shuffler.py#L618-L631
train
A map function used in hash phase.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/shuffler.py
_MergingReader.split_input
def split_input(cls, mapper_spec): """Split input into multiple shards.""" filelists = mapper_spec.params[cls.FILES_PARAM] max_values_count = mapper_spec.params.get(cls.MAX_VALUES_COUNT_PARAM, -1) max_values_size = mapper_spec.params.get(cls.MAX_VALUES_SIZE_PARAM, -1) return [cls([0] * len(files), m...
python
def split_input(cls, mapper_spec): """Split input into multiple shards.""" filelists = mapper_spec.params[cls.FILES_PARAM] max_values_count = mapper_spec.params.get(cls.MAX_VALUES_COUNT_PARAM, -1) max_values_size = mapper_spec.params.get(cls.MAX_VALUES_SIZE_PARAM, -1) return [cls([0] * len(files), m...
[ "def", "split_input", "(", "cls", ",", "mapper_spec", ")", ":", "filelists", "=", "mapper_spec", ".", "params", "[", "cls", ".", "FILES_PARAM", "]", "max_values_count", "=", "mapper_spec", ".", "params", ".", "get", "(", "cls", ".", "MAX_VALUES_COUNT_PARAM", ...
Split input into multiple shards.
[ "Split", "input", "into", "multiple", "shards", "." ]
2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/shuffler.py#L386-L392
train
Split input into multiple shards.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/shuffler.py
_MergingReader.validate
def validate(cls, mapper_spec): """Validate reader parameters in mapper_spec.""" if mapper_spec.input_reader_class() != cls: raise errors.BadReaderParamsError("Input reader class mismatch") params = mapper_spec.params if cls.FILES_PARAM not in params: raise errors.BadReaderParamsError("Missi...
python
def validate(cls, mapper_spec): """Validate reader parameters in mapper_spec.""" if mapper_spec.input_reader_class() != cls: raise errors.BadReaderParamsError("Input reader class mismatch") params = mapper_spec.params if cls.FILES_PARAM not in params: raise errors.BadReaderParamsError("Missi...
[ "def", "validate", "(", "cls", ",", "mapper_spec", ")", ":", "if", "mapper_spec", ".", "input_reader_class", "(", ")", "!=", "cls", ":", "raise", "errors", ".", "BadReaderParamsError", "(", "\"Input reader class mismatch\"", ")", "params", "=", "mapper_spec", "....
Validate reader parameters in mapper_spec.
[ "Validate", "reader", "parameters", "in", "mapper_spec", "." ]
2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/shuffler.py#L395-L401
train
Validate reader parameters in mapper_spec.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/shuffler.py
_HashingGCSOutputWriter.validate
def validate(cls, mapper_spec): """Validates mapper specification. Args: mapper_spec: an instance of model.MapperSpec to validate. Raises: BadWriterParamsError: when Output writer class mismatch. """ if mapper_spec.output_writer_class() != cls: raise errors.BadWriterParamsError("O...
python
def validate(cls, mapper_spec): """Validates mapper specification. Args: mapper_spec: an instance of model.MapperSpec to validate. Raises: BadWriterParamsError: when Output writer class mismatch. """ if mapper_spec.output_writer_class() != cls: raise errors.BadWriterParamsError("O...
[ "def", "validate", "(", "cls", ",", "mapper_spec", ")", ":", "if", "mapper_spec", ".", "output_writer_class", "(", ")", "!=", "cls", ":", "raise", "errors", ".", "BadWriterParamsError", "(", "\"Output writer class mismatch\"", ")", "params", "=", "output_writers",...
Validates mapper specification. Args: mapper_spec: an instance of model.MapperSpec to validate. Raises: BadWriterParamsError: when Output writer class mismatch.
[ "Validates", "mapper", "specification", "." ]
2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/shuffler.py#L429-L444
train
Validates the mapper specification.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/shuffler.py
_HashingGCSOutputWriter.to_json
def to_json(self): """Returns writer state to serialize in json. Returns: A json-izable version of the OutputWriter state. """ # Use the member variable (since we don't have access to the context) to # flush each pool to minimize the size of each filehandle before we # serialize it. f...
python
def to_json(self): """Returns writer state to serialize in json. Returns: A json-izable version of the OutputWriter state. """ # Use the member variable (since we don't have access to the context) to # flush each pool to minimize the size of each filehandle before we # serialize it. f...
[ "def", "to_json", "(", "self", ")", ":", "# Use the member variable (since we don't have access to the context) to", "# flush each pool to minimize the size of each filehandle before we", "# serialize it.", "for", "pool", "in", "self", ".", "_pools", ":", "if", "pool", "is", "n...
Returns writer state to serialize in json. Returns: A json-izable version of the OutputWriter state.
[ "Returns", "writer", "state", "to", "serialize", "in", "json", "." ]
2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/shuffler.py#L458-L470
train
Returns the json -izable version of the OutputWriter state to serialize in json.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/shuffler.py
_HashingGCSOutputWriter.create
def create(cls, mr_spec, shard_number, shard_attempt, _writer_state=None): """Inherit docs.""" mapper_spec = mr_spec.mapper params = output_writers._get_params(mapper_spec) bucket_name = params.get(cls.BUCKET_NAME_PARAM) shards = mapper_spec.shard_count filehandles = [] filename = (mr_spec....
python
def create(cls, mr_spec, shard_number, shard_attempt, _writer_state=None): """Inherit docs.""" mapper_spec = mr_spec.mapper params = output_writers._get_params(mapper_spec) bucket_name = params.get(cls.BUCKET_NAME_PARAM) shards = mapper_spec.shard_count filehandles = [] filename = (mr_spec....
[ "def", "create", "(", "cls", ",", "mr_spec", ",", "shard_number", ",", "shard_attempt", ",", "_writer_state", "=", "None", ")", ":", "mapper_spec", "=", "mr_spec", ".", "mapper", "params", "=", "output_writers", ".", "_get_params", "(", "mapper_spec", ")", "...
Inherit docs.
[ "Inherit", "docs", "." ]
2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/shuffler.py#L473-L486
train
Inherit docs.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/shuffler.py
_HashingGCSOutputWriter.get_filenames
def get_filenames(cls, mapreduce_state): """See parent class.""" shards = mapreduce_state.mapreduce_spec.mapper.shard_count filenames = [] for _ in range(shards): filenames.append([None] * shards) shard_states = model.ShardState.find_all_by_mapreduce_state(mapreduce_state) for x, shard_sta...
python
def get_filenames(cls, mapreduce_state): """See parent class.""" shards = mapreduce_state.mapreduce_spec.mapper.shard_count filenames = [] for _ in range(shards): filenames.append([None] * shards) shard_states = model.ShardState.find_all_by_mapreduce_state(mapreduce_state) for x, shard_sta...
[ "def", "get_filenames", "(", "cls", ",", "mapreduce_state", ")", ":", "shards", "=", "mapreduce_state", ".", "mapreduce_spec", ".", "mapper", ".", "shard_count", "filenames", "=", "[", "]", "for", "_", "in", "range", "(", "shards", ")", ":", "filenames", "...
See parent class.
[ "See", "parent", "class", "." ]
2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/shuffler.py#L489-L500
train
Get the list of filenames for the shard.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/shuffler.py
_HashingGCSOutputWriter.finalize
def finalize(self, ctx, shard_state): """See parent class.""" filenames = [] for filehandle in self._filehandles: filenames.append(filehandle.name) filehandle.close() shard_state.writer_state = {"shard_filenames": filenames}
python
def finalize(self, ctx, shard_state): """See parent class.""" filenames = [] for filehandle in self._filehandles: filenames.append(filehandle.name) filehandle.close() shard_state.writer_state = {"shard_filenames": filenames}
[ "def", "finalize", "(", "self", ",", "ctx", ",", "shard_state", ")", ":", "filenames", "=", "[", "]", "for", "filehandle", "in", "self", ".", "_filehandles", ":", "filenames", ".", "append", "(", "filehandle", ".", "name", ")", "filehandle", ".", "close"...
See parent class.
[ "See", "parent", "class", "." ]
2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/shuffler.py#L502-L508
train
Finalize the shard.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/shuffler.py
_HashingGCSOutputWriter.write
def write(self, data): """Write data. Args: data: actual data yielded from handler. Type is writer-specific. """ ctx = context.get() if len(data) != 2: logging.error("Got bad tuple of length %d (2-tuple expected): %s", len(data), data) try: key = str(data[...
python
def write(self, data): """Write data. Args: data: actual data yielded from handler. Type is writer-specific. """ ctx = context.get() if len(data) != 2: logging.error("Got bad tuple of length %d (2-tuple expected): %s", len(data), data) try: key = str(data[...
[ "def", "write", "(", "self", ",", "data", ")", ":", "ctx", "=", "context", ".", "get", "(", ")", "if", "len", "(", "data", ")", "!=", "2", ":", "logging", ".", "error", "(", "\"Got bad tuple of length %d (2-tuple expected): %s\"", ",", "len", "(", "data"...
Write data. Args: data: actual data yielded from handler. Type is writer-specific.
[ "Write", "data", "." ]
2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/shuffler.py#L510-L543
train
Write data to a single file.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/api/map_job/map_job_config.py
JobConfig._get_mapper_params
def _get_mapper_params(self): """Converts self to model.MapperSpec.params.""" reader_params = self.input_reader_cls.params_to_json( self.input_reader_params) # TODO(user): Do the same for writer params. return {"input_reader": reader_params, "output_writer": self.output_writer_params...
python
def _get_mapper_params(self): """Converts self to model.MapperSpec.params.""" reader_params = self.input_reader_cls.params_to_json( self.input_reader_params) # TODO(user): Do the same for writer params. return {"input_reader": reader_params, "output_writer": self.output_writer_params...
[ "def", "_get_mapper_params", "(", "self", ")", ":", "reader_params", "=", "self", ".", "input_reader_cls", ".", "params_to_json", "(", "self", ".", "input_reader_params", ")", "# TODO(user): Do the same for writer params.", "return", "{", "\"input_reader\"", ":", "reade...
Converts self to model.MapperSpec.params.
[ "Converts", "self", "to", "model", ".", "MapperSpec", ".", "params", "." ]
2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/api/map_job/map_job_config.py#L114-L120
train
Converts self to model. MapperSpec. params.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/api/map_job/map_job_config.py
JobConfig._get_mapper_spec
def _get_mapper_spec(self): """Converts self to model.MapperSpec.""" # pylint: disable=g-import-not-at-top from mapreduce import model return model.MapperSpec( handler_spec=util._obj_to_path(self.mapper), input_reader_spec=util._obj_to_path(self.input_reader_cls), params=self._g...
python
def _get_mapper_spec(self): """Converts self to model.MapperSpec.""" # pylint: disable=g-import-not-at-top from mapreduce import model return model.MapperSpec( handler_spec=util._obj_to_path(self.mapper), input_reader_spec=util._obj_to_path(self.input_reader_cls), params=self._g...
[ "def", "_get_mapper_spec", "(", "self", ")", ":", "# pylint: disable=g-import-not-at-top", "from", "mapreduce", "import", "model", "return", "model", ".", "MapperSpec", "(", "handler_spec", "=", "util", ".", "_obj_to_path", "(", "self", ".", "mapper", ")", ",", ...
Converts self to model.MapperSpec.
[ "Converts", "self", "to", "model", ".", "MapperSpec", "." ]
2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/api/map_job/map_job_config.py#L122-L132
train
Converts self to model. MapperSpec.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/api/map_job/map_job_config.py
JobConfig._get_mr_params
def _get_mr_params(self): """Converts self to model.MapreduceSpec.params.""" return {"force_writes": self._force_writes, "done_callback": self.done_callback_url, "user_params": self.user_params, "shard_max_attempts": self.shard_max_attempts, "task_max_attempts": s...
python
def _get_mr_params(self): """Converts self to model.MapreduceSpec.params.""" return {"force_writes": self._force_writes, "done_callback": self.done_callback_url, "user_params": self.user_params, "shard_max_attempts": self.shard_max_attempts, "task_max_attempts": s...
[ "def", "_get_mr_params", "(", "self", ")", ":", "return", "{", "\"force_writes\"", ":", "self", ".", "_force_writes", ",", "\"done_callback\"", ":", "self", ".", "done_callback_url", ",", "\"user_params\"", ":", "self", ".", "user_params", ",", "\"shard_max_attemp...
Converts self to model.MapreduceSpec.params.
[ "Converts", "self", "to", "model", ".", "MapreduceSpec", ".", "params", "." ]
2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/api/map_job/map_job_config.py#L134-L146
train
Converts self to model. MapreduceSpec. params.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/api/map_job/map_job_config.py
JobConfig._get_default_mr_params
def _get_default_mr_params(cls): """Gets default values for old API.""" cfg = cls(_lenient=True) mr_params = cfg._get_mr_params() mr_params["api_version"] = 0 return mr_params
python
def _get_default_mr_params(cls): """Gets default values for old API.""" cfg = cls(_lenient=True) mr_params = cfg._get_mr_params() mr_params["api_version"] = 0 return mr_params
[ "def", "_get_default_mr_params", "(", "cls", ")", ":", "cfg", "=", "cls", "(", "_lenient", "=", "True", ")", "mr_params", "=", "cfg", ".", "_get_mr_params", "(", ")", "mr_params", "[", "\"api_version\"", "]", "=", "0", "return", "mr_params" ]
Gets default values for old API.
[ "Gets", "default", "values", "for", "old", "API", "." ]
2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/api/map_job/map_job_config.py#L154-L159
train
Gets default values for old API.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/api/map_job/map_job_config.py
JobConfig._to_map_job_config
def _to_map_job_config(cls, mr_spec, # TODO(user): Remove this parameter after it can be # read from mr_spec. queue_name): """Converts model.MapreduceSpec back to JobConfig. This method allows our internal metho...
python
def _to_map_job_config(cls, mr_spec, # TODO(user): Remove this parameter after it can be # read from mr_spec. queue_name): """Converts model.MapreduceSpec back to JobConfig. This method allows our internal metho...
[ "def", "_to_map_job_config", "(", "cls", ",", "mr_spec", ",", "# TODO(user): Remove this parameter after it can be", "# read from mr_spec.", "queue_name", ")", ":", "mapper_spec", "=", "mr_spec", ".", "mapper", "# 0 means all the old APIs before api_version is introduced.", "api_...
Converts model.MapreduceSpec back to JobConfig. This method allows our internal methods to use JobConfig directly. This method also allows us to expose JobConfig as an API during execution, despite that it is not saved into datastore. Args: mr_spec: model.MapreduceSpec. queue_name: queue n...
[ "Converts", "model", ".", "MapreduceSpec", "back", "to", "JobConfig", "." ]
2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/api/map_job/map_job_config.py#L162-L226
train
Converts MapreduceSpec to JobConfig.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/records.py
RecordsWriter.__write_record
def __write_record(self, record_type, data): """Write single physical record.""" length = len(data) crc = crc32c.crc_update(crc32c.CRC_INIT, [record_type]) crc = crc32c.crc_update(crc, data) crc = crc32c.crc_finalize(crc) self.__writer.write( struct.pack(_HEADER_FORMAT, _mask_crc(crc),...
python
def __write_record(self, record_type, data): """Write single physical record.""" length = len(data) crc = crc32c.crc_update(crc32c.CRC_INIT, [record_type]) crc = crc32c.crc_update(crc, data) crc = crc32c.crc_finalize(crc) self.__writer.write( struct.pack(_HEADER_FORMAT, _mask_crc(crc),...
[ "def", "__write_record", "(", "self", ",", "record_type", ",", "data", ")", ":", "length", "=", "len", "(", "data", ")", "crc", "=", "crc32c", ".", "crc_update", "(", "crc32c", ".", "CRC_INIT", ",", "[", "record_type", "]", ")", "crc", "=", "crc32c", ...
Write single physical record.
[ "Write", "single", "physical", "record", "." ]
2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/records.py#L160-L171
train
Write a single physical record.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/records.py
RecordsWriter.write
def write(self, data): """Write single record. Args: data: record data to write as string, byte array or byte sequence. """ block_remaining = _BLOCK_SIZE - self.__position % _BLOCK_SIZE if block_remaining < _HEADER_LENGTH: # Header won't fit into remainder self.__writer.write('\x...
python
def write(self, data): """Write single record. Args: data: record data to write as string, byte array or byte sequence. """ block_remaining = _BLOCK_SIZE - self.__position % _BLOCK_SIZE if block_remaining < _HEADER_LENGTH: # Header won't fit into remainder self.__writer.write('\x...
[ "def", "write", "(", "self", ",", "data", ")", ":", "block_remaining", "=", "_BLOCK_SIZE", "-", "self", ".", "__position", "%", "_BLOCK_SIZE", "if", "block_remaining", "<", "_HEADER_LENGTH", ":", "# Header won't fit into remainder", "self", ".", "__writer", ".", ...
Write single record. Args: data: record data to write as string, byte array or byte sequence.
[ "Write", "single", "record", "." ]
2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/records.py#L173-L202
train
Writes a single record.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/records.py
RecordsWriter._pad_block
def _pad_block(self): """Pad block with 0. Pad current block with 0. Reader will simply treat these as corrupted record and skip the block. This method is idempotent. """ pad_length = _BLOCK_SIZE - self.__position % _BLOCK_SIZE if pad_length and pad_length != _BLOCK_SIZE: self.__writ...
python
def _pad_block(self): """Pad block with 0. Pad current block with 0. Reader will simply treat these as corrupted record and skip the block. This method is idempotent. """ pad_length = _BLOCK_SIZE - self.__position % _BLOCK_SIZE if pad_length and pad_length != _BLOCK_SIZE: self.__writ...
[ "def", "_pad_block", "(", "self", ")", ":", "pad_length", "=", "_BLOCK_SIZE", "-", "self", ".", "__position", "%", "_BLOCK_SIZE", "if", "pad_length", "and", "pad_length", "!=", "_BLOCK_SIZE", ":", "self", ".", "__writer", ".", "write", "(", "'\\x00'", "*", ...
Pad block with 0. Pad current block with 0. Reader will simply treat these as corrupted record and skip the block. This method is idempotent.
[ "Pad", "block", "with", "0", "." ]
2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/records.py#L213-L224
train
Pad current block with 0.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/records.py
RecordsReader.__try_read_record
def __try_read_record(self): """Try reading a record. Returns: (data, record_type) tuple. Raises: EOFError: when end of file was reached. InvalidRecordError: when valid record could not be read. """ block_remaining = _BLOCK_SIZE - self.__reader.tell() % _BLOCK_SIZE if block_re...
python
def __try_read_record(self): """Try reading a record. Returns: (data, record_type) tuple. Raises: EOFError: when end of file was reached. InvalidRecordError: when valid record could not be read. """ block_remaining = _BLOCK_SIZE - self.__reader.tell() % _BLOCK_SIZE if block_re...
[ "def", "__try_read_record", "(", "self", ")", ":", "block_remaining", "=", "_BLOCK_SIZE", "-", "self", ".", "__reader", ".", "tell", "(", ")", "%", "_BLOCK_SIZE", "if", "block_remaining", "<", "_HEADER_LENGTH", ":", "return", "(", "''", ",", "_RECORD_TYPE_NONE...
Try reading a record. Returns: (data, record_type) tuple. Raises: EOFError: when end of file was reached. InvalidRecordError: when valid record could not be read.
[ "Try", "reading", "a", "record", "." ]
2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/records.py#L239-L278
train
Try reading a record.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/records.py
RecordsReader.__sync
def __sync(self): """Skip reader to the block boundary.""" pad_length = _BLOCK_SIZE - self.__reader.tell() % _BLOCK_SIZE if pad_length and pad_length != _BLOCK_SIZE: data = self.__reader.read(pad_length) if len(data) != pad_length: raise EOFError('Read %d bytes instead of %d' % ...
python
def __sync(self): """Skip reader to the block boundary.""" pad_length = _BLOCK_SIZE - self.__reader.tell() % _BLOCK_SIZE if pad_length and pad_length != _BLOCK_SIZE: data = self.__reader.read(pad_length) if len(data) != pad_length: raise EOFError('Read %d bytes instead of %d' % ...
[ "def", "__sync", "(", "self", ")", ":", "pad_length", "=", "_BLOCK_SIZE", "-", "self", ".", "__reader", ".", "tell", "(", ")", "%", "_BLOCK_SIZE", "if", "pad_length", "and", "pad_length", "!=", "_BLOCK_SIZE", ":", "data", "=", "self", ".", "__reader", "....
Skip reader to the block boundary.
[ "Skip", "reader", "to", "the", "block", "boundary", "." ]
2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/records.py#L280-L287
train
Skip reader to the block boundary.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/records.py
RecordsReader.read
def read(self): """Reads record from current position in reader. Returns: original bytes stored in a single record. """ data = None while True: last_offset = self.tell() try: (chunk, record_type) = self.__try_read_record() if record_type == _RECORD_TYPE_NONE: ...
python
def read(self): """Reads record from current position in reader. Returns: original bytes stored in a single record. """ data = None while True: last_offset = self.tell() try: (chunk, record_type) = self.__try_read_record() if record_type == _RECORD_TYPE_NONE: ...
[ "def", "read", "(", "self", ")", ":", "data", "=", "None", "while", "True", ":", "last_offset", "=", "self", ".", "tell", "(", ")", "try", ":", "(", "chunk", ",", "record_type", ")", "=", "self", ".", "__try_read_record", "(", ")", "if", "record_type...
Reads record from current position in reader. Returns: original bytes stored in a single record.
[ "Reads", "record", "from", "current", "position", "in", "reader", "." ]
2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/records.py#L289-L338
train
Reads a single record from the current position in reader.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/mapper_pipeline.py
MapperPipeline.run
def run(self, job_name, handler_spec, input_reader_spec, output_writer_spec=None, params=None, shards=None, base_path=None): """Start a mapreduce job. Args: job_name: mapreduce name. Only for display purpose. handler_spec: fully ...
python
def run(self, job_name, handler_spec, input_reader_spec, output_writer_spec=None, params=None, shards=None, base_path=None): """Start a mapreduce job. Args: job_name: mapreduce name. Only for display purpose. handler_spec: fully ...
[ "def", "run", "(", "self", ",", "job_name", ",", "handler_spec", ",", "input_reader_spec", ",", "output_writer_spec", "=", "None", ",", "params", "=", "None", ",", "shards", "=", "None", ",", "base_path", "=", "None", ")", ":", "if", "shards", "is", "Non...
Start a mapreduce job. Args: job_name: mapreduce name. Only for display purpose. handler_spec: fully qualified name to your map function/class. input_reader_spec: fully qualified name to input reader class. output_writer_spec: fully qualified name to output writer class. params: a dic...
[ "Start", "a", "mapreduce", "job", "." ]
2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/mapper_pipeline.py#L65-L106
train
This method starts a mapreduce job.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/mapper_pipeline.py
MapperPipeline.callback
def callback(self): """Callback after this async pipeline finishes.""" if self.was_aborted: return mapreduce_id = self.outputs.job_id.value mapreduce_state = model.MapreduceState.get_by_job_id(mapreduce_id) if mapreduce_state.result_status != model.MapreduceState.RESULT_SUCCESS: self.re...
python
def callback(self): """Callback after this async pipeline finishes.""" if self.was_aborted: return mapreduce_id = self.outputs.job_id.value mapreduce_state = model.MapreduceState.get_by_job_id(mapreduce_id) if mapreduce_state.result_status != model.MapreduceState.RESULT_SUCCESS: self.re...
[ "def", "callback", "(", "self", ")", ":", "if", "self", ".", "was_aborted", ":", "return", "mapreduce_id", "=", "self", ".", "outputs", ".", "job_id", ".", "value", "mapreduce_state", "=", "model", ".", "MapreduceState", ".", "get_by_job_id", "(", "mapreduce...
Callback after this async pipeline finishes.
[ "Callback", "after", "this", "async", "pipeline", "finishes", "." ]
2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/mapper_pipeline.py#L112-L133
train
Callback after this async pipeline finishes.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/control.py
start_map
def start_map(name, handler_spec, reader_spec, mapper_parameters, shard_count=None, output_writer_spec=None, mapreduce_parameters=None, base_path=None, queue_name=None, eta=None, c...
python
def start_map(name, handler_spec, reader_spec, mapper_parameters, shard_count=None, output_writer_spec=None, mapreduce_parameters=None, base_path=None, queue_name=None, eta=None, c...
[ "def", "start_map", "(", "name", ",", "handler_spec", ",", "reader_spec", ",", "mapper_parameters", ",", "shard_count", "=", "None", ",", "output_writer_spec", "=", "None", ",", "mapreduce_parameters", "=", "None", ",", "base_path", "=", "None", ",", "queue_name...
Start a new, mapper-only mapreduce. Deprecated! Use map_job.start instead. If a value can be specified both from an explicit argument and from a dictionary, the value from the explicit argument wins. Args: name: mapreduce name. Used only for display purposes. handler_spec: fully qualified name of map...
[ "Start", "a", "new", "mapper", "-", "only", "mapreduce", "." ]
2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/control.py#L37-L125
train
Start a new mapreduce job.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/api/map_job/map_job_control.py
Job.get_status
def get_status(self): """Get status enum. Returns: One of the status enum. """ self.__update_state() if self._state.active: return self.RUNNING else: return self._state.result_status
python
def get_status(self): """Get status enum. Returns: One of the status enum. """ self.__update_state() if self._state.active: return self.RUNNING else: return self._state.result_status
[ "def", "get_status", "(", "self", ")", ":", "self", ".", "__update_state", "(", ")", "if", "self", ".", "_state", ".", "active", ":", "return", "self", ".", "RUNNING", "else", ":", "return", "self", ".", "_state", ".", "result_status" ]
Get status enum. Returns: One of the status enum.
[ "Get", "status", "enum", "." ]
2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/api/map_job/map_job_control.py#L70-L80
train
Get status enum.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/api/map_job/map_job_control.py
Job.get_counter
def get_counter(self, counter_name, default=0): """Get the value of the named counter from this job. When a job is running, counter values won't be very accurate. Args: counter_name: name of the counter in string. default: default value if the counter doesn't exist. Returns: Value i...
python
def get_counter(self, counter_name, default=0): """Get the value of the named counter from this job. When a job is running, counter values won't be very accurate. Args: counter_name: name of the counter in string. default: default value if the counter doesn't exist. Returns: Value i...
[ "def", "get_counter", "(", "self", ",", "counter_name", ",", "default", "=", "0", ")", ":", "self", ".", "__update_state", "(", ")", "return", "self", ".", "_state", ".", "counters_map", ".", "get", "(", "counter_name", ",", "default", ")" ]
Get the value of the named counter from this job. When a job is running, counter values won't be very accurate. Args: counter_name: name of the counter in string. default: default value if the counter doesn't exist. Returns: Value in int of the named counter.
[ "Get", "the", "value", "of", "the", "named", "counter", "from", "this", "job", "." ]
2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/api/map_job/map_job_control.py#L98-L111
train
Get the value of the named counter from this job.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/api/map_job/map_job_control.py
Job.get_outputs
def get_outputs(self): """Get outputs of this job. Should only call if status is SUCCESS. Yields: Iterators, one for each shard. Each iterator is from the argument of map_job.output_writer.commit_output. """ assert self.SUCCESS == self.get_status() ss = model.ShardState.find_all_by...
python
def get_outputs(self): """Get outputs of this job. Should only call if status is SUCCESS. Yields: Iterators, one for each shard. Each iterator is from the argument of map_job.output_writer.commit_output. """ assert self.SUCCESS == self.get_status() ss = model.ShardState.find_all_by...
[ "def", "get_outputs", "(", "self", ")", ":", "assert", "self", ".", "SUCCESS", "==", "self", ".", "get_status", "(", ")", "ss", "=", "model", ".", "ShardState", ".", "find_all_by_mapreduce_state", "(", "self", ".", "_state", ")", "for", "s", "in", "ss", ...
Get outputs of this job. Should only call if status is SUCCESS. Yields: Iterators, one for each shard. Each iterator is from the argument of map_job.output_writer.commit_output.
[ "Get", "outputs", "of", "this", "job", "." ]
2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/api/map_job/map_job_control.py#L113-L125
train
Get outputs of this job.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/api/map_job/map_job_control.py
Job.submit
def submit(cls, job_config, in_xg_transaction=False): """Submit the job to run. Args: job_config: an instance of map_job.MapJobConfig. in_xg_transaction: controls what transaction scope to use to start this MR job. If True, there has to be an already opened cross-group transaction s...
python
def submit(cls, job_config, in_xg_transaction=False): """Submit the job to run. Args: job_config: an instance of map_job.MapJobConfig. in_xg_transaction: controls what transaction scope to use to start this MR job. If True, there has to be an already opened cross-group transaction s...
[ "def", "submit", "(", "cls", ",", "job_config", ",", "in_xg_transaction", "=", "False", ")", ":", "cls", ".", "__validate_job_config", "(", "job_config", ")", "mapper_spec", "=", "job_config", ".", "_get_mapper_spec", "(", ")", "# Create mr spec.", "mapreduce_para...
Submit the job to run. Args: job_config: an instance of map_job.MapJobConfig. in_xg_transaction: controls what transaction scope to use to start this MR job. If True, there has to be an already opened cross-group transaction scope. MR will use one entity group from it. If False,...
[ "Submit", "the", "job", "to", "run", "." ]
2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/api/map_job/map_job_control.py#L128-L168
train
Submit the job to run.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/api/map_job/map_job_control.py
Job.__update_state
def __update_state(self): """Fetches most up to date state from db.""" # Only if the job was not in a terminal state. if self._state.active: self._state = self.__get_state_by_id(self.job_config.job_id)
python
def __update_state(self): """Fetches most up to date state from db.""" # Only if the job was not in a terminal state. if self._state.active: self._state = self.__get_state_by_id(self.job_config.job_id)
[ "def", "__update_state", "(", "self", ")", ":", "# Only if the job was not in a terminal state.", "if", "self", ".", "_state", ".", "active", ":", "self", ".", "_state", "=", "self", ".", "__get_state_by_id", "(", "self", ".", "job_config", ".", "job_id", ")" ]
Fetches most up to date state from db.
[ "Fetches", "most", "up", "to", "date", "state", "from", "db", "." ]
2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/api/map_job/map_job_control.py#L170-L174
train
Updates the state of the job.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/api/map_job/map_job_control.py
Job.__get_state_by_id
def __get_state_by_id(cls, job_id): """Get job state by id. Args: job_id: job id. Returns: model.MapreduceState for the job. Raises: ValueError: if the job state is missing. """ state = model.MapreduceState.get_by_job_id(job_id) if state is None: raise ValueError("...
python
def __get_state_by_id(cls, job_id): """Get job state by id. Args: job_id: job id. Returns: model.MapreduceState for the job. Raises: ValueError: if the job state is missing. """ state = model.MapreduceState.get_by_job_id(job_id) if state is None: raise ValueError("...
[ "def", "__get_state_by_id", "(", "cls", ",", "job_id", ")", ":", "state", "=", "model", ".", "MapreduceState", ".", "get_by_job_id", "(", "job_id", ")", "if", "state", "is", "None", ":", "raise", "ValueError", "(", "\"Job state for job %s is missing.\"", "%", ...
Get job state by id. Args: job_id: job id. Returns: model.MapreduceState for the job. Raises: ValueError: if the job state is missing.
[ "Get", "job", "state", "by", "id", "." ]
2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/api/map_job/map_job_control.py#L177-L192
train
Get the job state by id.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/api/map_job/map_job_control.py
Job.__create_and_save_state
def __create_and_save_state(cls, job_config, mapreduce_spec): """Save map job state to datastore. Save state to datastore so that UI can see it immediately. Args: job_config: map_job.JobConfig. mapreduce_spec: model.MapreduceSpec. Returns: model.MapreduceState for this job. """ ...
python
def __create_and_save_state(cls, job_config, mapreduce_spec): """Save map job state to datastore. Save state to datastore so that UI can see it immediately. Args: job_config: map_job.JobConfig. mapreduce_spec: model.MapreduceSpec. Returns: model.MapreduceState for this job. """ ...
[ "def", "__create_and_save_state", "(", "cls", ",", "job_config", ",", "mapreduce_spec", ")", ":", "state", "=", "model", ".", "MapreduceState", ".", "create_new", "(", "job_config", ".", "job_id", ")", "state", ".", "mapreduce_spec", "=", "mapreduce_spec", "stat...
Save map job state to datastore. Save state to datastore so that UI can see it immediately. Args: job_config: map_job.JobConfig. mapreduce_spec: model.MapreduceSpec. Returns: model.MapreduceState for this job.
[ "Save", "map", "job", "state", "to", "datastore", "." ]
2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/api/map_job/map_job_control.py#L202-L221
train
Create and save the map job state to datastore.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/api/map_job/map_job_control.py
Job.__add_kickoff_task
def __add_kickoff_task(cls, job_config, mapreduce_spec): """Add kickoff task to taskqueue. Args: job_config: map_job.JobConfig. mapreduce_spec: model.MapreduceSpec, """ params = {"mapreduce_id": job_config.job_id} # Task is not named so that it can be added within a transaction. kic...
python
def __add_kickoff_task(cls, job_config, mapreduce_spec): """Add kickoff task to taskqueue. Args: job_config: map_job.JobConfig. mapreduce_spec: model.MapreduceSpec, """ params = {"mapreduce_id": job_config.job_id} # Task is not named so that it can be added within a transaction. kic...
[ "def", "__add_kickoff_task", "(", "cls", ",", "job_config", ",", "mapreduce_spec", ")", ":", "params", "=", "{", "\"mapreduce_id\"", ":", "job_config", ".", "job_id", "}", "# Task is not named so that it can be added within a transaction.", "kickoff_task", "=", "taskqueue...
Add kickoff task to taskqueue. Args: job_config: map_job.JobConfig. mapreduce_spec: model.MapreduceSpec,
[ "Add", "kickoff", "task", "to", "taskqueue", "." ]
2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/api/map_job/map_job_control.py#L224-L245
train
Add kickoff task to taskqueue.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/json_util.py
JsonMixin.to_json_str
def to_json_str(self): """Convert data to json string representation. Returns: json representation as string. """ _json = self.to_json() try: return json.dumps(_json, sort_keys=True, cls=JsonEncoder) except: logging.exception("Could not serialize JSON: %r", _json) raise
python
def to_json_str(self): """Convert data to json string representation. Returns: json representation as string. """ _json = self.to_json() try: return json.dumps(_json, sort_keys=True, cls=JsonEncoder) except: logging.exception("Could not serialize JSON: %r", _json) raise
[ "def", "to_json_str", "(", "self", ")", ":", "_json", "=", "self", ".", "to_json", "(", ")", "try", ":", "return", "json", ".", "dumps", "(", "_json", ",", "sort_keys", "=", "True", ",", "cls", "=", "JsonEncoder", ")", "except", ":", "logging", ".", ...
Convert data to json string representation. Returns: json representation as string.
[ "Convert", "data", "to", "json", "string", "representation", "." ]
2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/json_util.py#L135-L146
train
Convert data to json string representation.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/json_util.py
JsonMixin.from_json_str
def from_json_str(cls, json_str): """Convert json string representation into class instance. Args: json_str: json representation as string. Returns: New instance of the class with data loaded from json string. """ return cls.from_json(json.loads(json_str, cls=JsonDecoder))
python
def from_json_str(cls, json_str): """Convert json string representation into class instance. Args: json_str: json representation as string. Returns: New instance of the class with data loaded from json string. """ return cls.from_json(json.loads(json_str, cls=JsonDecoder))
[ "def", "from_json_str", "(", "cls", ",", "json_str", ")", ":", "return", "cls", ".", "from_json", "(", "json", ".", "loads", "(", "json_str", ",", "cls", "=", "JsonDecoder", ")", ")" ]
Convert json string representation into class instance. Args: json_str: json representation as string. Returns: New instance of the class with data loaded from json string.
[ "Convert", "json", "string", "representation", "into", "class", "instance", "." ]
2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/json_util.py#L149-L158
train
Convert json string representation into object.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/json_util.py
JsonProperty.get_value_for_datastore
def get_value_for_datastore(self, model_instance): """Gets value for datastore. Args: model_instance: instance of the model class. Returns: datastore-compatible value. """ value = super(JsonProperty, self).get_value_for_datastore(model_instance) if not value: return None ...
python
def get_value_for_datastore(self, model_instance): """Gets value for datastore. Args: model_instance: instance of the model class. Returns: datastore-compatible value. """ value = super(JsonProperty, self).get_value_for_datastore(model_instance) if not value: return None ...
[ "def", "get_value_for_datastore", "(", "self", ",", "model_instance", ")", ":", "value", "=", "super", "(", "JsonProperty", ",", "self", ")", ".", "get_value_for_datastore", "(", "model_instance", ")", "if", "not", "value", ":", "return", "None", "json_value", ...
Gets value for datastore. Args: model_instance: instance of the model class. Returns: datastore-compatible value.
[ "Gets", "value", "for", "datastore", "." ]
2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/json_util.py#L183-L201
train
Gets value for the datastore.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/json_util.py
JsonProperty.make_value_from_datastore
def make_value_from_datastore(self, value): """Convert value from datastore representation. Args: value: datastore value. Returns: value to store in the model. """ if value is None: return None _json = json.loads(value, cls=JsonDecoder) if self.data_type == dict: r...
python
def make_value_from_datastore(self, value): """Convert value from datastore representation. Args: value: datastore value. Returns: value to store in the model. """ if value is None: return None _json = json.loads(value, cls=JsonDecoder) if self.data_type == dict: r...
[ "def", "make_value_from_datastore", "(", "self", ",", "value", ")", ":", "if", "value", "is", "None", ":", "return", "None", "_json", "=", "json", ".", "loads", "(", "value", ",", "cls", "=", "JsonDecoder", ")", "if", "self", ".", "data_type", "==", "d...
Convert value from datastore representation. Args: value: datastore value. Returns: value to store in the model.
[ "Convert", "value", "from", "datastore", "representation", "." ]
2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/json_util.py#L203-L218
train
Convert value from datastore representation.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/json_util.py
JsonProperty.validate
def validate(self, value): """Validate value. Args: value: model value. Returns: Whether the specified value is valid data type value. Raises: BadValueError: when value is not of self.data_type type. """ if value is not None and not isinstance(value, self.data_type): r...
python
def validate(self, value): """Validate value. Args: value: model value. Returns: Whether the specified value is valid data type value. Raises: BadValueError: when value is not of self.data_type type. """ if value is not None and not isinstance(value, self.data_type): r...
[ "def", "validate", "(", "self", ",", "value", ")", ":", "if", "value", "is", "not", "None", "and", "not", "isinstance", "(", "value", ",", "self", ".", "data_type", ")", ":", "raise", "datastore_errors", ".", "BadValueError", "(", "\"Property %s must be conv...
Validate value. Args: value: model value. Returns: Whether the specified value is valid data type value. Raises: BadValueError: when value is not of self.data_type type.
[ "Validate", "value", "." ]
2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/json_util.py#L220-L236
train
Validate the specified value.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/model.py
HugeTask.add
def add(self, queue_name, transactional=False): """Add task to the queue.""" task = self.to_task() task.add(queue_name, transactional)
python
def add(self, queue_name, transactional=False): """Add task to the queue.""" task = self.to_task() task.add(queue_name, transactional)
[ "def", "add", "(", "self", ",", "queue_name", ",", "transactional", "=", "False", ")", ":", "task", "=", "self", ".", "to_task", "(", ")", "task", ".", "add", "(", "queue_name", ",", "transactional", ")" ]
Add task to the queue.
[ "Add", "task", "to", "the", "queue", "." ]
2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/model.py#L161-L164
train
Add a task to the queue.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/model.py
HugeTask.to_task
def to_task(self): """Convert to a taskqueue task.""" # Never pass params to taskqueue.Task. Use payload instead. Otherwise, # it's up to a particular taskqueue implementation to generate # payload from params. It could blow up payload size over limit. return taskqueue.Task( url=self.url, ...
python
def to_task(self): """Convert to a taskqueue task.""" # Never pass params to taskqueue.Task. Use payload instead. Otherwise, # it's up to a particular taskqueue implementation to generate # payload from params. It could blow up payload size over limit. return taskqueue.Task( url=self.url, ...
[ "def", "to_task", "(", "self", ")", ":", "# Never pass params to taskqueue.Task. Use payload instead. Otherwise,", "# it's up to a particular taskqueue implementation to generate", "# payload from params. It could blow up payload size over limit.", "return", "taskqueue", ".", "Task", "(", ...
Convert to a taskqueue task.
[ "Convert", "to", "a", "taskqueue", "task", "." ]
2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/model.py#L166-L177
train
Convert to a taskqueue task.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/model.py
HugeTask.decode_payload
def decode_payload(cls, request): """Decode task payload. HugeTask controls its own payload entirely including urlencoding. It doesn't depend on any particular web framework. Args: request: a webapp Request instance. Returns: A dict of str to str. The same as the params argument to __...
python
def decode_payload(cls, request): """Decode task payload. HugeTask controls its own payload entirely including urlencoding. It doesn't depend on any particular web framework. Args: request: a webapp Request instance. Returns: A dict of str to str. The same as the params argument to __...
[ "def", "decode_payload", "(", "cls", ",", "request", ")", ":", "# TODO(user): Pass mr_id into headers. Otherwise when payload decoding", "# failed, we can't abort a mr.", "if", "request", ".", "headers", ".", "get", "(", "cls", ".", "PAYLOAD_VERSION_HEADER", ")", "!=", "c...
Decode task payload. HugeTask controls its own payload entirely including urlencoding. It doesn't depend on any particular web framework. Args: request: a webapp Request instance. Returns: A dict of str to str. The same as the params argument to __init__. Raises: DeprecationWar...
[ "Decode", "task", "payload", "." ]
2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/model.py#L180-L202
train
Decode the payload of a Huge task.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/model.py
CountersMap.increment
def increment(self, counter_name, delta): """Increment counter value. Args: counter_name: counter name as String. delta: increment delta as Integer. Returns: new counter value. """ current_value = self.counters.get(counter_name, 0) new_value = current_value + delta self.c...
python
def increment(self, counter_name, delta): """Increment counter value. Args: counter_name: counter name as String. delta: increment delta as Integer. Returns: new counter value. """ current_value = self.counters.get(counter_name, 0) new_value = current_value + delta self.c...
[ "def", "increment", "(", "self", ",", "counter_name", ",", "delta", ")", ":", "current_value", "=", "self", ".", "counters", ".", "get", "(", "counter_name", ",", "0", ")", "new_value", "=", "current_value", "+", "delta", "self", ".", "counters", "[", "c...
Increment counter value. Args: counter_name: counter name as String. delta: increment delta as Integer. Returns: new counter value.
[ "Increment", "counter", "value", "." ]
2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/model.py#L263-L276
train
Increment the value of a counter.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/model.py
CountersMap.add_map
def add_map(self, counters_map): """Add all counters from the map. For each counter in the passed map, adds its value to the counter in this map. Args: counters_map: CounterMap instance to add. """ for counter_name in counters_map.counters: self.increment(counter_name, counters_map...
python
def add_map(self, counters_map): """Add all counters from the map. For each counter in the passed map, adds its value to the counter in this map. Args: counters_map: CounterMap instance to add. """ for counter_name in counters_map.counters: self.increment(counter_name, counters_map...
[ "def", "add_map", "(", "self", ",", "counters_map", ")", ":", "for", "counter_name", "in", "counters_map", ".", "counters", ":", "self", ".", "increment", "(", "counter_name", ",", "counters_map", ".", "counters", "[", "counter_name", "]", ")" ]
Add all counters from the map. For each counter in the passed map, adds its value to the counter in this map. Args: counters_map: CounterMap instance to add.
[ "Add", "all", "counters", "from", "the", "map", "." ]
2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/model.py#L278-L288
train
Adds all counters from the passed map to the current object.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/model.py
CountersMap.sub_map
def sub_map(self, counters_map): """Subtracts all counters from the map. For each counter in the passed map, subtracts its value to the counter in this map. Args: counters_map: CounterMap instance to subtract. """ for counter_name in counters_map.counters: self.increment(counter_na...
python
def sub_map(self, counters_map): """Subtracts all counters from the map. For each counter in the passed map, subtracts its value to the counter in this map. Args: counters_map: CounterMap instance to subtract. """ for counter_name in counters_map.counters: self.increment(counter_na...
[ "def", "sub_map", "(", "self", ",", "counters_map", ")", ":", "for", "counter_name", "in", "counters_map", ".", "counters", ":", "self", ".", "increment", "(", "counter_name", ",", "-", "counters_map", ".", "counters", "[", "counter_name", "]", ")" ]
Subtracts all counters from the map. For each counter in the passed map, subtracts its value to the counter in this map. Args: counters_map: CounterMap instance to subtract.
[ "Subtracts", "all", "counters", "from", "the", "map", "." ]
2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/model.py#L290-L300
train
Subtracts all counters from the passed map.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/model.py
MapperSpec.to_json
def to_json(self): """Serializes this MapperSpec into a json-izable object.""" result = { "mapper_handler_spec": self.handler_spec, "mapper_input_reader": self.input_reader_spec, "mapper_params": self.params, "mapper_shard_count": self.shard_count } if self.output_writer_...
python
def to_json(self): """Serializes this MapperSpec into a json-izable object.""" result = { "mapper_handler_spec": self.handler_spec, "mapper_input_reader": self.input_reader_spec, "mapper_params": self.params, "mapper_shard_count": self.shard_count } if self.output_writer_...
[ "def", "to_json", "(", "self", ")", ":", "result", "=", "{", "\"mapper_handler_spec\"", ":", "self", ".", "handler_spec", ",", "\"mapper_input_reader\"", ":", "self", ".", "input_reader_spec", ",", "\"mapper_params\"", ":", "self", ".", "params", ",", "\"mapper_...
Serializes this MapperSpec into a json-izable object.
[ "Serializes", "this", "MapperSpec", "into", "a", "json", "-", "izable", "object", "." ]
2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/model.py#L412-L422
train
Serializes this MapperSpec into a json -izable object.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/model.py
MapreduceSpec.get_hooks
def get_hooks(self): """Returns a hooks.Hooks class or None if no hooks class has been set.""" if self.__hooks is None and self.hooks_class_name is not None: hooks_class = util.for_name(self.hooks_class_name) if not isinstance(hooks_class, type): raise ValueError("hooks_class_name must refer...
python
def get_hooks(self): """Returns a hooks.Hooks class or None if no hooks class has been set.""" if self.__hooks is None and self.hooks_class_name is not None: hooks_class = util.for_name(self.hooks_class_name) if not isinstance(hooks_class, type): raise ValueError("hooks_class_name must refer...
[ "def", "get_hooks", "(", "self", ")", ":", "if", "self", ".", "__hooks", "is", "None", "and", "self", ".", "hooks_class_name", "is", "not", "None", ":", "hooks_class", "=", "util", ".", "for_name", "(", "self", ".", "hooks_class_name", ")", "if", "not", ...
Returns a hooks.Hooks class or None if no hooks class has been set.
[ "Returns", "a", "hooks", ".", "Hooks", "class", "or", "None", "if", "no", "hooks", "class", "has", "been", "set", "." ]
2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/model.py#L488-L500
train
Returns a hooks. Hooks class or None if no hooks class has been set.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/model.py
MapreduceSpec.to_json
def to_json(self): """Serializes all data in this mapreduce spec into json form. Returns: data in json format. """ mapper_spec = self.mapper.to_json() return { "name": self.name, "mapreduce_id": self.mapreduce_id, "mapper_spec": mapper_spec, "params": self.para...
python
def to_json(self): """Serializes all data in this mapreduce spec into json form. Returns: data in json format. """ mapper_spec = self.mapper.to_json() return { "name": self.name, "mapreduce_id": self.mapreduce_id, "mapper_spec": mapper_spec, "params": self.para...
[ "def", "to_json", "(", "self", ")", ":", "mapper_spec", "=", "self", ".", "mapper", ".", "to_json", "(", ")", "return", "{", "\"name\"", ":", "self", ".", "name", ",", "\"mapreduce_id\"", ":", "self", ".", "mapreduce_id", ",", "\"mapper_spec\"", ":", "ma...
Serializes all data in this mapreduce spec into json form. Returns: data in json format.
[ "Serializes", "all", "data", "in", "this", "mapreduce", "spec", "into", "json", "form", "." ]
2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/model.py#L502-L515
train
Serializes all data in this mapreduce spec into json form.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/model.py
MapreduceSpec.from_json
def from_json(cls, json): """Create new MapreduceSpec from the json, encoded by to_json. Args: json: json representation of MapreduceSpec. Returns: an instance of MapreduceSpec with all data deserialized from json. """ mapreduce_spec = cls(json["name"], json["m...
python
def from_json(cls, json): """Create new MapreduceSpec from the json, encoded by to_json. Args: json: json representation of MapreduceSpec. Returns: an instance of MapreduceSpec with all data deserialized from json. """ mapreduce_spec = cls(json["name"], json["m...
[ "def", "from_json", "(", "cls", ",", "json", ")", ":", "mapreduce_spec", "=", "cls", "(", "json", "[", "\"name\"", "]", ",", "json", "[", "\"mapreduce_id\"", "]", ",", "json", "[", "\"mapper_spec\"", "]", ",", "json", ".", "get", "(", "\"params\"", ")"...
Create new MapreduceSpec from the json, encoded by to_json. Args: json: json representation of MapreduceSpec. Returns: an instance of MapreduceSpec with all data deserialized from json.
[ "Create", "new", "MapreduceSpec", "from", "the", "json", "encoded", "by", "to_json", "." ]
2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/model.py#L518-L532
train
Create a MapreduceSpec from the json representation of a MapreduceSpec.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/model.py
MapreduceSpec._get_mapreduce_spec
def _get_mapreduce_spec(cls, mr_id): """Get Mapreduce spec from mr id.""" key = 'GAE-MR-spec: %s' % mr_id spec_json = memcache.get(key) if spec_json: return cls.from_json(spec_json) state = MapreduceState.get_by_job_id(mr_id) spec = state.mapreduce_spec spec_json = spec.to_json() m...
python
def _get_mapreduce_spec(cls, mr_id): """Get Mapreduce spec from mr id.""" key = 'GAE-MR-spec: %s' % mr_id spec_json = memcache.get(key) if spec_json: return cls.from_json(spec_json) state = MapreduceState.get_by_job_id(mr_id) spec = state.mapreduce_spec spec_json = spec.to_json() m...
[ "def", "_get_mapreduce_spec", "(", "cls", ",", "mr_id", ")", ":", "key", "=", "'GAE-MR-spec: %s'", "%", "mr_id", "spec_json", "=", "memcache", ".", "get", "(", "key", ")", "if", "spec_json", ":", "return", "cls", ".", "from_json", "(", "spec_json", ")", ...
Get Mapreduce spec from mr id.
[ "Get", "Mapreduce", "spec", "from", "mr", "id", "." ]
2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/model.py#L543-L553
train
Get Mapreduce spec from mr id.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/model.py
MapreduceState.get_key_by_job_id
def get_key_by_job_id(cls, mapreduce_id): """Retrieves the Key for a Job. Args: mapreduce_id: The job to retrieve. Returns: Datastore Key that can be used to fetch the MapreduceState. """ return db.Key.from_path(cls.kind(), str(mapreduce_id))
python
def get_key_by_job_id(cls, mapreduce_id): """Retrieves the Key for a Job. Args: mapreduce_id: The job to retrieve. Returns: Datastore Key that can be used to fetch the MapreduceState. """ return db.Key.from_path(cls.kind(), str(mapreduce_id))
[ "def", "get_key_by_job_id", "(", "cls", ",", "mapreduce_id", ")", ":", "return", "db", ".", "Key", ".", "from_path", "(", "cls", ".", "kind", "(", ")", ",", "str", "(", "mapreduce_id", ")", ")" ]
Retrieves the Key for a Job. Args: mapreduce_id: The job to retrieve. Returns: Datastore Key that can be used to fetch the MapreduceState.
[ "Retrieves", "the", "Key", "for", "a", "Job", "." ]
2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/model.py#L614-L623
train
Retrieves the Key for a Job.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/model.py
MapreduceState.set_processed_counts
def set_processed_counts(self, shards_processed, shards_status): """Updates a chart url to display processed count for each shard. Args: shards_processed: list of integers with number of processed entities in each shard """ chart = google_chart_api.BarChart() def filter_status(status...
python
def set_processed_counts(self, shards_processed, shards_status): """Updates a chart url to display processed count for each shard. Args: shards_processed: list of integers with number of processed entities in each shard """ chart = google_chart_api.BarChart() def filter_status(status...
[ "def", "set_processed_counts", "(", "self", ",", "shards_processed", ",", "shards_status", ")", ":", "chart", "=", "google_chart_api", ".", "BarChart", "(", ")", "def", "filter_status", "(", "status_to_filter", ")", ":", "return", "[", "count", "if", "status", ...
Updates a chart url to display processed count for each shard. Args: shards_processed: list of integers with number of processed entities in each shard
[ "Updates", "a", "chart", "url", "to", "display", "processed", "count", "for", "each", "shard", "." ]
2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/model.py#L637-L690
train
Updates a chart url to display processed count for each shard.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/model.py
MapreduceState.create_new
def create_new(mapreduce_id=None, gettime=datetime.datetime.now): """Create a new MapreduceState. Args: mapreduce_id: Mapreduce id as string. gettime: Used for testing. """ if not mapreduce_id: mapreduce_id = MapreduceState.new_mapreduce_id() state = MapreduceStat...
python
def create_new(mapreduce_id=None, gettime=datetime.datetime.now): """Create a new MapreduceState. Args: mapreduce_id: Mapreduce id as string. gettime: Used for testing. """ if not mapreduce_id: mapreduce_id = MapreduceState.new_mapreduce_id() state = MapreduceStat...
[ "def", "create_new", "(", "mapreduce_id", "=", "None", ",", "gettime", "=", "datetime", ".", "datetime", ".", "now", ")", ":", "if", "not", "mapreduce_id", ":", "mapreduce_id", "=", "MapreduceState", ".", "new_mapreduce_id", "(", ")", "state", "=", "Mapreduc...
Create a new MapreduceState. Args: mapreduce_id: Mapreduce id as string. gettime: Used for testing.
[ "Create", "a", "new", "MapreduceState", "." ]
2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/model.py#L703-L716
train
Create a new MapreduceState object.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/model.py
TransientShardState.reset_for_retry
def reset_for_retry(self, output_writer): """Reset self for shard retry. Args: output_writer: new output writer that contains new output files. """ self.input_reader = self.initial_input_reader self.slice_id = 0 self.retries += 1 self.output_writer = output_writer self.handler = s...
python
def reset_for_retry(self, output_writer): """Reset self for shard retry. Args: output_writer: new output writer that contains new output files. """ self.input_reader = self.initial_input_reader self.slice_id = 0 self.retries += 1 self.output_writer = output_writer self.handler = s...
[ "def", "reset_for_retry", "(", "self", ",", "output_writer", ")", ":", "self", ".", "input_reader", "=", "self", ".", "initial_input_reader", "self", ".", "slice_id", "=", "0", "self", ".", "retries", "+=", "1", "self", ".", "output_writer", "=", "output_wri...
Reset self for shard retry. Args: output_writer: new output writer that contains new output files.
[ "Reset", "self", "for", "shard", "retry", "." ]
2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/model.py#L776-L786
train
Reset self for shard retry.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/model.py
TransientShardState.advance_for_next_slice
def advance_for_next_slice(self, recovery_slice=False): """Advance relavent states for next slice. Args: recovery_slice: True if this slice is running recovery logic. See handlers.MapperWorkerCallbackHandler._attempt_slice_recovery for more info. """ if recovery_slice: self....
python
def advance_for_next_slice(self, recovery_slice=False): """Advance relavent states for next slice. Args: recovery_slice: True if this slice is running recovery logic. See handlers.MapperWorkerCallbackHandler._attempt_slice_recovery for more info. """ if recovery_slice: self....
[ "def", "advance_for_next_slice", "(", "self", ",", "recovery_slice", "=", "False", ")", ":", "if", "recovery_slice", ":", "self", ".", "slice_id", "+=", "2", "# Restore input reader to the beginning of the slice.", "self", ".", "input_reader", "=", "self", ".", "inp...
Advance relavent states for next slice. Args: recovery_slice: True if this slice is running recovery logic. See handlers.MapperWorkerCallbackHandler._attempt_slice_recovery for more info.
[ "Advance", "relavent", "states", "for", "next", "slice", "." ]
2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/model.py#L788-L801
train
Advance relavent states for next slice.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/model.py
TransientShardState.to_dict
def to_dict(self): """Convert state to dictionary to save in task payload.""" result = {"mapreduce_spec": self.mapreduce_spec.to_json_str(), "shard_id": self.shard_id, "slice_id": str(self.slice_id), "input_reader_state": self.input_reader.to_json_str(), "...
python
def to_dict(self): """Convert state to dictionary to save in task payload.""" result = {"mapreduce_spec": self.mapreduce_spec.to_json_str(), "shard_id": self.shard_id, "slice_id": str(self.slice_id), "input_reader_state": self.input_reader.to_json_str(), "...
[ "def", "to_dict", "(", "self", ")", ":", "result", "=", "{", "\"mapreduce_spec\"", ":", "self", ".", "mapreduce_spec", ".", "to_json_str", "(", ")", ",", "\"shard_id\"", ":", "self", ".", "shard_id", ",", "\"slice_id\"", ":", "str", "(", "self", ".", "sl...
Convert state to dictionary to save in task payload.
[ "Convert", "state", "to", "dictionary", "to", "save", "in", "task", "payload", "." ]
2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/model.py#L803-L817
train
Convert state to dictionary to save in task payload.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/model.py
TransientShardState.from_request
def from_request(cls, request): """Create new TransientShardState from webapp request.""" mapreduce_spec = MapreduceSpec.from_json_str(request.get("mapreduce_spec")) mapper_spec = mapreduce_spec.mapper input_reader_spec_dict = json.loads(request.get("input_reader_state"), ...
python
def from_request(cls, request): """Create new TransientShardState from webapp request.""" mapreduce_spec = MapreduceSpec.from_json_str(request.get("mapreduce_spec")) mapper_spec = mapreduce_spec.mapper input_reader_spec_dict = json.loads(request.get("input_reader_state"), ...
[ "def", "from_request", "(", "cls", ",", "request", ")", ":", "mapreduce_spec", "=", "MapreduceSpec", ".", "from_json_str", "(", "request", ".", "get", "(", "\"mapreduce_spec\"", ")", ")", "mapper_spec", "=", "mapreduce_spec", ".", "mapper", "input_reader_spec_dict...
Create new TransientShardState from webapp request.
[ "Create", "new", "TransientShardState", "from", "webapp", "request", "." ]
2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/model.py#L820-L855
train
Create TransientShardState from webapp request.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/model.py
ShardState.reset_for_retry
def reset_for_retry(self): """Reset self for shard retry.""" self.retries += 1 self.last_work_item = "" self.active = True self.result_status = None self.input_finished = False self.counters_map = CountersMap() self.slice_id = 0 self.slice_start_time = None self.slice_request_id ...
python
def reset_for_retry(self): """Reset self for shard retry.""" self.retries += 1 self.last_work_item = "" self.active = True self.result_status = None self.input_finished = False self.counters_map = CountersMap() self.slice_id = 0 self.slice_start_time = None self.slice_request_id ...
[ "def", "reset_for_retry", "(", "self", ")", ":", "self", ".", "retries", "+=", "1", "self", ".", "last_work_item", "=", "\"\"", "self", ".", "active", "=", "True", "self", ".", "result_status", "=", "None", "self", ".", "input_finished", "=", "False", "s...
Reset self for shard retry.
[ "Reset", "self", "for", "shard", "retry", "." ]
2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/model.py#L973-L985
train
Reset self for shard retry.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/model.py
ShardState.advance_for_next_slice
def advance_for_next_slice(self, recovery_slice=False): """Advance self for next slice. Args: recovery_slice: True if this slice is running recovery logic. See handlers.MapperWorkerCallbackHandler._attempt_slice_recovery for more info. """ self.slice_start_time = None self.sli...
python
def advance_for_next_slice(self, recovery_slice=False): """Advance self for next slice. Args: recovery_slice: True if this slice is running recovery logic. See handlers.MapperWorkerCallbackHandler._attempt_slice_recovery for more info. """ self.slice_start_time = None self.sli...
[ "def", "advance_for_next_slice", "(", "self", ",", "recovery_slice", "=", "False", ")", ":", "self", ".", "slice_start_time", "=", "None", "self", ".", "slice_request_id", "=", "None", "self", ".", "slice_retries", "=", "0", "self", ".", "acquired_once", "=", ...
Advance self for next slice. Args: recovery_slice: True if this slice is running recovery logic. See handlers.MapperWorkerCallbackHandler._attempt_slice_recovery for more info.
[ "Advance", "self", "for", "next", "slice", "." ]
2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/model.py#L987-L1002
train
Advance self for next slice.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/model.py
ShardState.copy_from
def copy_from(self, other_state): """Copy data from another shard state entity to self.""" for prop in self.properties().values(): setattr(self, prop.name, getattr(other_state, prop.name))
python
def copy_from(self, other_state): """Copy data from another shard state entity to self.""" for prop in self.properties().values(): setattr(self, prop.name, getattr(other_state, prop.name))
[ "def", "copy_from", "(", "self", ",", "other_state", ")", ":", "for", "prop", "in", "self", ".", "properties", "(", ")", ".", "values", "(", ")", ":", "setattr", "(", "self", ",", "prop", ".", "name", ",", "getattr", "(", "other_state", ",", "prop", ...
Copy data from another shard state entity to self.
[ "Copy", "data", "from", "another", "shard", "state", "entity", "to", "self", "." ]
2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/model.py#L1026-L1029
train
Copy data from another shard state entity to self.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/model.py
ShardState.find_all_by_mapreduce_state
def find_all_by_mapreduce_state(cls, mapreduce_state): """Find all shard states for given mapreduce. Args: mapreduce_state: MapreduceState instance Yields: shard states sorted by shard id. """ keys = cls.calculate_keys_by_mapreduce_state(mapreduce_state) i = 0 while i < len(key...
python
def find_all_by_mapreduce_state(cls, mapreduce_state): """Find all shard states for given mapreduce. Args: mapreduce_state: MapreduceState instance Yields: shard states sorted by shard id. """ keys = cls.calculate_keys_by_mapreduce_state(mapreduce_state) i = 0 while i < len(key...
[ "def", "find_all_by_mapreduce_state", "(", "cls", ",", "mapreduce_state", ")", ":", "keys", "=", "cls", ".", "calculate_keys_by_mapreduce_state", "(", "mapreduce_state", ")", "i", "=", "0", "while", "i", "<", "len", "(", "keys", ")", ":", "@", "db", ".", "...
Find all shard states for given mapreduce. Args: mapreduce_state: MapreduceState instance Yields: shard states sorted by shard id.
[ "Find", "all", "shard", "states", "for", "given", "mapreduce", "." ]
2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/model.py#L1106-L1127
train
Find all shard states for given mapreduce state.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/model.py
ShardState.calculate_keys_by_mapreduce_state
def calculate_keys_by_mapreduce_state(cls, mapreduce_state): """Calculate all shard states keys for given mapreduce. Args: mapreduce_state: MapreduceState instance Returns: A list of keys for shard states, sorted by shard id. The corresponding shard states may not exist. """ if m...
python
def calculate_keys_by_mapreduce_state(cls, mapreduce_state): """Calculate all shard states keys for given mapreduce. Args: mapreduce_state: MapreduceState instance Returns: A list of keys for shard states, sorted by shard id. The corresponding shard states may not exist. """ if m...
[ "def", "calculate_keys_by_mapreduce_state", "(", "cls", ",", "mapreduce_state", ")", ":", "if", "mapreduce_state", "is", "None", ":", "return", "[", "]", "keys", "=", "[", "]", "for", "i", "in", "range", "(", "mapreduce_state", ".", "mapreduce_spec", ".", "m...
Calculate all shard states keys for given mapreduce. Args: mapreduce_state: MapreduceState instance Returns: A list of keys for shard states, sorted by shard id. The corresponding shard states may not exist.
[ "Calculate", "all", "shard", "states", "keys", "for", "given", "mapreduce", "." ]
2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/model.py#L1130-L1147
train
Calculate all shard states keys for given mapreduce.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/model.py
ShardState.create_new
def create_new(cls, mapreduce_id, shard_number): """Create new shard state. Args: mapreduce_id: unique mapreduce id as string. shard_number: shard number for which to create shard state. Returns: new instance of ShardState ready to put into datastore. """ shard_id = cls.shard_id_...
python
def create_new(cls, mapreduce_id, shard_number): """Create new shard state. Args: mapreduce_id: unique mapreduce id as string. shard_number: shard number for which to create shard state. Returns: new instance of ShardState ready to put into datastore. """ shard_id = cls.shard_id_...
[ "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",...
Create new shard state. Args: mapreduce_id: unique mapreduce id as string. shard_number: shard number for which to create shard state. Returns: new instance of ShardState ready to put into datastore.
[ "Create", "new", "shard", "state", "." ]
2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/model.py#L1150-L1163
train
Create a new shard state.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/model.py
MapreduceControl.get_key_by_job_id
def get_key_by_job_id(cls, mapreduce_id): """Retrieves the Key for a mapreduce ID. Args: mapreduce_id: The job to fetch. Returns: Datastore Key for the command for the given job ID. """ return db.Key.from_path(cls.kind(), "%s:%s" % (mapreduce_id, cls._KEY_NAME))
python
def get_key_by_job_id(cls, mapreduce_id): """Retrieves the Key for a mapreduce ID. Args: mapreduce_id: The job to fetch. Returns: Datastore Key for the command for the given job ID. """ return db.Key.from_path(cls.kind(), "%s:%s" % (mapreduce_id, cls._KEY_NAME))
[ "def", "get_key_by_job_id", "(", "cls", ",", "mapreduce_id", ")", ":", "return", "db", ".", "Key", ".", "from_path", "(", "cls", ".", "kind", "(", ")", ",", "\"%s:%s\"", "%", "(", "mapreduce_id", ",", "cls", ".", "_KEY_NAME", ")", ")" ]
Retrieves the Key for a mapreduce ID. Args: mapreduce_id: The job to fetch. Returns: Datastore Key for the command for the given job ID.
[ "Retrieves", "the", "Key", "for", "a", "mapreduce", "ID", "." ]
2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/model.py#L1188-L1197
train
Retrieves the Key for a given mapreduce ID.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/model.py
MapreduceControl.abort
def abort(cls, mapreduce_id, **kwargs): """Causes a job to abort. Args: mapreduce_id: The job to abort. Not verified as a valid job. """ cls(key_name="%s:%s" % (mapreduce_id, cls._KEY_NAME), command=cls.ABORT).put(**kwargs)
python
def abort(cls, mapreduce_id, **kwargs): """Causes a job to abort. Args: mapreduce_id: The job to abort. Not verified as a valid job. """ cls(key_name="%s:%s" % (mapreduce_id, cls._KEY_NAME), command=cls.ABORT).put(**kwargs)
[ "def", "abort", "(", "cls", ",", "mapreduce_id", ",", "*", "*", "kwargs", ")", ":", "cls", "(", "key_name", "=", "\"%s:%s\"", "%", "(", "mapreduce_id", ",", "cls", ".", "_KEY_NAME", ")", ",", "command", "=", "cls", ".", "ABORT", ")", ".", "put", "(...
Causes a job to abort. Args: mapreduce_id: The job to abort. Not verified as a valid job.
[ "Causes", "a", "job", "to", "abort", "." ]
2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/model.py#L1200-L1207
train
Aborts a job in a sequence.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/api/map_job/datastore_input_reader.py
DatastoreInputReader.validate
def validate(cls, job_config): """Inherit docs.""" super(DatastoreInputReader, cls).validate(job_config) params = job_config.input_reader_params entity_kind = params[cls.ENTITY_KIND_PARAM] # Check for a "." in the entity kind. if "." in entity_kind: logging.warning( ". detected i...
python
def validate(cls, job_config): """Inherit docs.""" super(DatastoreInputReader, cls).validate(job_config) params = job_config.input_reader_params entity_kind = params[cls.ENTITY_KIND_PARAM] # Check for a "." in the entity kind. if "." in entity_kind: logging.warning( ". detected i...
[ "def", "validate", "(", "cls", ",", "job_config", ")", ":", "super", "(", "DatastoreInputReader", ",", "cls", ")", ".", "validate", "(", "job_config", ")", "params", "=", "job_config", ".", "input_reader_params", "entity_kind", "=", "params", "[", "cls", "."...
Inherit docs.
[ "Inherit", "docs", "." ]
2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/api/map_job/datastore_input_reader.py#L32-L49
train
Inherit docs.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/base_handler.py
TaskQueueHandler.initialize
def initialize(self, request, response): """Initialize. 1. call webapp init. 2. check request is indeed from taskqueue. 3. check the task has not been retried too many times. 4. run handler specific processing logic. 5. run error handling logic if precessing failed. Args: request: a ...
python
def initialize(self, request, response): """Initialize. 1. call webapp init. 2. check request is indeed from taskqueue. 3. check the task has not been retried too many times. 4. run handler specific processing logic. 5. run error handling logic if precessing failed. Args: request: a ...
[ "def", "initialize", "(", "self", ",", "request", ",", "response", ")", ":", "super", "(", "TaskQueueHandler", ",", "self", ")", ".", "initialize", "(", "request", ",", "response", ")", "# Check request is from taskqueue.", "if", "\"X-AppEngine-QueueName\"", "not"...
Initialize. 1. call webapp init. 2. check request is indeed from taskqueue. 3. check the task has not been retried too many times. 4. run handler specific processing logic. 5. run error handling logic if precessing failed. Args: request: a webapp.Request instance. response: a webap...
[ "Initialize", "." ]
2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/base_handler.py#L93-L134
train
Initialize the task queue.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...