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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
GoogleCloudPlatform/appengine-mapreduce | python/src/mapreduce/base_handler.py | TaskQueueHandler.retry_task | def retry_task(self):
"""Ask taskqueue to retry this task.
Even though raising an exception can cause a task retry, it
will flood logs with highly visible ERROR logs. Handlers should uses
this method to perform controlled task retries. Only raise exceptions
for those deserve ERROR log entries.
... | python | def retry_task(self):
"""Ask taskqueue to retry this task.
Even though raising an exception can cause a task retry, it
will flood logs with highly visible ERROR logs. Handlers should uses
this method to perform controlled task retries. Only raise exceptions
for those deserve ERROR log entries.
... | [
"def",
"retry_task",
"(",
"self",
")",
":",
"self",
".",
"response",
".",
"set_status",
"(",
"httplib",
".",
"SERVICE_UNAVAILABLE",
",",
"\"Retry task\"",
")",
"self",
".",
"response",
".",
"clear",
"(",
")"
] | Ask taskqueue to retry this task.
Even though raising an exception can cause a task retry, it
will flood logs with highly visible ERROR logs. Handlers should uses
this method to perform controlled task retries. Only raise exceptions
for those deserve ERROR log entries. | [
"Ask",
"taskqueue",
"to",
"retry",
"this",
"task",
"."
] | 2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6 | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/base_handler.py#L163-L172 | train | Ask taskqueue to retry this 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/base_handler.py | JsonHandler.base_path | def base_path(self):
"""Base path for all mapreduce-related urls.
JSON handlers are mapped to /base_path/command/command_name thus they
require special treatment.
Raises:
BadRequestPathError: if the path does not end with "/command".
Returns:
The base path.
"""
path = self.req... | python | def base_path(self):
"""Base path for all mapreduce-related urls.
JSON handlers are mapped to /base_path/command/command_name thus they
require special treatment.
Raises:
BadRequestPathError: if the path does not end with "/command".
Returns:
The base path.
"""
path = self.req... | [
"def",
"base_path",
"(",
"self",
")",
":",
"path",
"=",
"self",
".",
"request",
".",
"path",
"base_path",
"=",
"path",
"[",
":",
"path",
".",
"rfind",
"(",
"\"/\"",
")",
"]",
"if",
"not",
"base_path",
".",
"endswith",
"(",
"\"/command\"",
")",
":",
... | Base path for all mapreduce-related urls.
JSON handlers are mapped to /base_path/command/command_name thus they
require special treatment.
Raises:
BadRequestPathError: if the path does not end with "/command".
Returns:
The base path. | [
"Base",
"path",
"for",
"all",
"mapreduce",
"-",
"related",
"urls",
"."
] | 2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6 | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/base_handler.py#L189-L206 | train | Returns the base path for all mapreduce - related urls. | 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 | JsonHandler._handle_wrapper | def _handle_wrapper(self):
"""The helper method for handling JSON Post and Get requests."""
if self.request.headers.get("X-Requested-With") != "XMLHttpRequest":
logging.error("Got JSON request with no X-Requested-With header")
self.response.set_status(
403, message="Got JSON request with n... | python | def _handle_wrapper(self):
"""The helper method for handling JSON Post and Get requests."""
if self.request.headers.get("X-Requested-With") != "XMLHttpRequest":
logging.error("Got JSON request with no X-Requested-With header")
self.response.set_status(
403, message="Got JSON request with n... | [
"def",
"_handle_wrapper",
"(",
"self",
")",
":",
"if",
"self",
".",
"request",
".",
"headers",
".",
"get",
"(",
"\"X-Requested-With\"",
")",
"!=",
"\"XMLHttpRequest\"",
":",
"logging",
".",
"error",
"(",
"\"Got JSON request with no X-Requested-With header\"",
")",
... | The helper method for handling JSON Post and Get requests. | [
"The",
"helper",
"method",
"for",
"handling",
"JSON",
"Post",
"and",
"Get",
"requests",
"."
] | 2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6 | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/base_handler.py#L208-L240 | train | The helper method for handling JSON Post and Get requests. | 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/tools/gcs_file_seg_reader.py | _GCSFileSegReader.read | def read(self, n):
"""Read data from file segs.
Args:
n: max bytes to read. Must be positive.
Returns:
some bytes. May be smaller than n bytes. "" when no more data is left.
"""
if self._EOF:
return ""
while self._seg_index <= self._last_seg_index:
result = self._read_... | python | def read(self, n):
"""Read data from file segs.
Args:
n: max bytes to read. Must be positive.
Returns:
some bytes. May be smaller than n bytes. "" when no more data is left.
"""
if self._EOF:
return ""
while self._seg_index <= self._last_seg_index:
result = self._read_... | [
"def",
"read",
"(",
"self",
",",
"n",
")",
":",
"if",
"self",
".",
"_EOF",
":",
"return",
"\"\"",
"while",
"self",
".",
"_seg_index",
"<=",
"self",
".",
"_last_seg_index",
":",
"result",
"=",
"self",
".",
"_read_from_seg",
"(",
"n",
")",
"if",
"resul... | Read data from file segs.
Args:
n: max bytes to read. Must be positive.
Returns:
some bytes. May be smaller than n bytes. "" when no more data is left. | [
"Read",
"data",
"from",
"file",
"segs",
"."
] | 2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6 | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/tools/gcs_file_seg_reader.py#L62-L82 | train | Reads n bytes from the segments in the 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/tools/gcs_file_seg_reader.py | _GCSFileSegReader._next_seg | def _next_seg(self):
"""Get next seg."""
if self._seg:
self._seg.close()
self._seg_index += 1
if self._seg_index > self._last_seg_index:
self._seg = None
return
filename = self._seg_prefix + str(self._seg_index)
stat = cloudstorage.stat(filename)
writer = output_writers._G... | python | def _next_seg(self):
"""Get next seg."""
if self._seg:
self._seg.close()
self._seg_index += 1
if self._seg_index > self._last_seg_index:
self._seg = None
return
filename = self._seg_prefix + str(self._seg_index)
stat = cloudstorage.stat(filename)
writer = output_writers._G... | [
"def",
"_next_seg",
"(",
"self",
")",
":",
"if",
"self",
".",
"_seg",
":",
"self",
".",
"_seg",
".",
"close",
"(",
")",
"self",
".",
"_seg_index",
"+=",
"1",
"if",
"self",
".",
"_seg_index",
">",
"self",
".",
"_last_seg_index",
":",
"self",
".",
"_... | Get next seg. | [
"Get",
"next",
"seg",
"."
] | 2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6 | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/tools/gcs_file_seg_reader.py#L92-L113 | train | Get next segment. | 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/tools/gcs_file_seg_reader.py | _GCSFileSegReader._read_from_seg | def _read_from_seg(self, n):
"""Read from current seg.
Args:
n: max number of bytes to read.
Returns:
valid bytes from the current seg. "" if no more is left.
"""
result = self._seg.read(size=n)
if result == "":
return result
offset = self._seg.tell()
if offset > self... | python | def _read_from_seg(self, n):
"""Read from current seg.
Args:
n: max number of bytes to read.
Returns:
valid bytes from the current seg. "" if no more is left.
"""
result = self._seg.read(size=n)
if result == "":
return result
offset = self._seg.tell()
if offset > self... | [
"def",
"_read_from_seg",
"(",
"self",
",",
"n",
")",
":",
"result",
"=",
"self",
".",
"_seg",
".",
"read",
"(",
"size",
"=",
"n",
")",
"if",
"result",
"==",
"\"\"",
":",
"return",
"result",
"offset",
"=",
"self",
".",
"_seg",
".",
"tell",
"(",
")... | Read from current seg.
Args:
n: max number of bytes to read.
Returns:
valid bytes from the current seg. "" if no more is left. | [
"Read",
"from",
"current",
"seg",
"."
] | 2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6 | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/tools/gcs_file_seg_reader.py#L115-L132 | train | Read n bytes from the current seg. | 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/util.py | _get_descending_key | def _get_descending_key(gettime=time.time):
"""Returns a key name lexically ordered by time descending.
This lets us have a key name for use with Datastore entities which returns
rows in time descending order when it is scanned in lexically ascending order,
allowing us to bypass index building for descending i... | python | def _get_descending_key(gettime=time.time):
"""Returns a key name lexically ordered by time descending.
This lets us have a key name for use with Datastore entities which returns
rows in time descending order when it is scanned in lexically ascending order,
allowing us to bypass index building for descending i... | [
"def",
"_get_descending_key",
"(",
"gettime",
"=",
"time",
".",
"time",
")",
":",
"now_descending",
"=",
"int",
"(",
"(",
"_FUTURE_TIME",
"-",
"gettime",
"(",
")",
")",
"*",
"100",
")",
"request_id_hash",
"=",
"os",
".",
"environ",
".",
"get",
"(",
"\"... | Returns a key name lexically ordered by time descending.
This lets us have a key name for use with Datastore entities which returns
rows in time descending order when it is scanned in lexically ascending order,
allowing us to bypass index building for descending indexes.
Args:
gettime: Used for testing.
... | [
"Returns",
"a",
"key",
"name",
"lexically",
"ordered",
"by",
"time",
"descending",
"."
] | 2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6 | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/util.py#L62-L79 | train | Returns a key name lexically ordered by time descending. | 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/util.py | _get_task_host | def _get_task_host():
"""Get the Host header value for all mr tasks.
Task Host header determines which instance this task would be routed to.
Current version id format is: v7.368834058928280579
Current module id is just the module's name. It could be "default"
Default version hostname is app_id.appspot.com
... | python | def _get_task_host():
"""Get the Host header value for all mr tasks.
Task Host header determines which instance this task would be routed to.
Current version id format is: v7.368834058928280579
Current module id is just the module's name. It could be "default"
Default version hostname is app_id.appspot.com
... | [
"def",
"_get_task_host",
"(",
")",
":",
"version",
"=",
"os",
".",
"environ",
"[",
"\"CURRENT_VERSION_ID\"",
"]",
".",
"split",
"(",
"\".\"",
")",
"[",
"0",
"]",
"default_host",
"=",
"os",
".",
"environ",
"[",
"\"DEFAULT_VERSION_HOSTNAME\"",
"]",
"module",
... | Get the Host header value for all mr tasks.
Task Host header determines which instance this task would be routed to.
Current version id format is: v7.368834058928280579
Current module id is just the module's name. It could be "default"
Default version hostname is app_id.appspot.com
Returns:
A complete ... | [
"Get",
"the",
"Host",
"header",
"value",
"for",
"all",
"mr",
"tasks",
"."
] | 2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6 | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/util.py#L82-L104 | train | Get the Host header value for all mr tasks. | 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/util.py | get_queue_name | def get_queue_name(queue_name):
"""Determine which queue MR should run on.
How to choose the queue:
1. If user provided one, use that.
2. If we are starting a mr from taskqueue, inherit that queue.
If it's a special queue, fall back to the default queue.
3. Default queue.
If user is using any MR pipe... | python | def get_queue_name(queue_name):
"""Determine which queue MR should run on.
How to choose the queue:
1. If user provided one, use that.
2. If we are starting a mr from taskqueue, inherit that queue.
If it's a special queue, fall back to the default queue.
3. Default queue.
If user is using any MR pipe... | [
"def",
"get_queue_name",
"(",
"queue_name",
")",
":",
"if",
"queue_name",
":",
"return",
"queue_name",
"queue_name",
"=",
"os",
".",
"environ",
".",
"get",
"(",
"\"HTTP_X_APPENGINE_QUEUENAME\"",
",",
"parameters",
".",
"config",
".",
"QUEUE_NAME",
")",
"if",
"... | Determine which queue MR should run on.
How to choose the queue:
1. If user provided one, use that.
2. If we are starting a mr from taskqueue, inherit that queue.
If it's a special queue, fall back to the default queue.
3. Default queue.
If user is using any MR pipeline interface, pipeline.start takes ... | [
"Determine",
"which",
"queue",
"MR",
"should",
"run",
"on",
"."
] | 2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6 | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/util.py#L127-L154 | train | Determine which queue MR should run on. | 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/util.py | total_seconds | def total_seconds(td):
"""convert a timedelta to seconds.
This is patterned after timedelta.total_seconds, which is only
available in python 27.
Args:
td: a timedelta object.
Returns:
total seconds within a timedelta. Rounded up to seconds.
"""
secs = td.seconds + td.days * 24 * 3600
if td.mi... | python | def total_seconds(td):
"""convert a timedelta to seconds.
This is patterned after timedelta.total_seconds, which is only
available in python 27.
Args:
td: a timedelta object.
Returns:
total seconds within a timedelta. Rounded up to seconds.
"""
secs = td.seconds + td.days * 24 * 3600
if td.mi... | [
"def",
"total_seconds",
"(",
"td",
")",
":",
"secs",
"=",
"td",
".",
"seconds",
"+",
"td",
".",
"days",
"*",
"24",
"*",
"3600",
"if",
"td",
".",
"microseconds",
":",
"secs",
"+=",
"1",
"return",
"secs"
] | convert a timedelta to seconds.
This is patterned after timedelta.total_seconds, which is only
available in python 27.
Args:
td: a timedelta object.
Returns:
total seconds within a timedelta. Rounded up to seconds. | [
"convert",
"a",
"timedelta",
"to",
"seconds",
"."
] | 2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6 | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/util.py#L157-L172 | train | convert a timedelta to seconds. | 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/util.py | handler_for_name | def handler_for_name(fq_name):
"""Resolves and instantiates handler by fully qualified name.
First resolves the name using for_name call. Then if it resolves to a class,
instantiates a class, if it resolves to a method - instantiates the class and
binds method to the instance.
Args:
fq_name: fully quali... | python | def handler_for_name(fq_name):
"""Resolves and instantiates handler by fully qualified name.
First resolves the name using for_name call. Then if it resolves to a class,
instantiates a class, if it resolves to a method - instantiates the class and
binds method to the instance.
Args:
fq_name: fully quali... | [
"def",
"handler_for_name",
"(",
"fq_name",
")",
":",
"resolved_name",
"=",
"for_name",
"(",
"fq_name",
")",
"if",
"isinstance",
"(",
"resolved_name",
",",
"(",
"type",
",",
"types",
".",
"ClassType",
")",
")",
":",
"# create new instance if this is type",
"retur... | Resolves and instantiates handler by fully qualified name.
First resolves the name using for_name call. Then if it resolves to a class,
instantiates a class, if it resolves to a method - instantiates the class and
binds method to the instance.
Args:
fq_name: fully qualified name of something to find.
R... | [
"Resolves",
"and",
"instantiates",
"handler",
"by",
"fully",
"qualified",
"name",
"."
] | 2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6 | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/util.py#L249-L270 | train | Resolves and instantiates a handler by fully qualified name. | 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/util.py | try_serialize_handler | def try_serialize_handler(handler):
"""Try to serialize map/reduce handler.
Args:
handler: handler function/instance. Handler can be a function or an
instance of a callable class. In the latter case, the handler will
be serialized across slices to allow users to save states.
Returns:
seriali... | python | def try_serialize_handler(handler):
"""Try to serialize map/reduce handler.
Args:
handler: handler function/instance. Handler can be a function or an
instance of a callable class. In the latter case, the handler will
be serialized across slices to allow users to save states.
Returns:
seriali... | [
"def",
"try_serialize_handler",
"(",
"handler",
")",
":",
"if",
"(",
"isinstance",
"(",
"handler",
",",
"types",
".",
"InstanceType",
")",
"or",
"# old style class",
"(",
"isinstance",
"(",
"handler",
",",
"object",
")",
"and",
"# new style class",
"not",
"ins... | Try to serialize map/reduce handler.
Args:
handler: handler function/instance. Handler can be a function or an
instance of a callable class. In the latter case, the handler will
be serialized across slices to allow users to save states.
Returns:
serialized handler string or None. | [
"Try",
"to",
"serialize",
"map",
"/",
"reduce",
"handler",
"."
] | 2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6 | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/util.py#L273-L290 | train | Try to serialize a function or an 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/util.py | is_generator | def is_generator(obj):
"""Return true if the object is generator or generator function.
Generator function objects provides same attributes as functions.
See isfunction.__doc__ for attributes listing.
Adapted from Python 2.6.
Args:
obj: an object to test.
Returns:
true if the object is generator... | python | def is_generator(obj):
"""Return true if the object is generator or generator function.
Generator function objects provides same attributes as functions.
See isfunction.__doc__ for attributes listing.
Adapted from Python 2.6.
Args:
obj: an object to test.
Returns:
true if the object is generator... | [
"def",
"is_generator",
"(",
"obj",
")",
":",
"if",
"isinstance",
"(",
"obj",
",",
"types",
".",
"GeneratorType",
")",
":",
"return",
"True",
"CO_GENERATOR",
"=",
"0x20",
"return",
"bool",
"(",
"(",
"(",
"inspect",
".",
"isfunction",
"(",
"obj",
")",
"o... | Return true if the object is generator or generator function.
Generator function objects provides same attributes as functions.
See isfunction.__doc__ for attributes listing.
Adapted from Python 2.6.
Args:
obj: an object to test.
Returns:
true if the object is generator function. | [
"Return",
"true",
"if",
"the",
"object",
"is",
"generator",
"or",
"generator",
"function",
"."
] | 2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6 | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/util.py#L306-L325 | train | Return true if the object is generator or generator function. | 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/util.py | parse_bool | def parse_bool(obj):
"""Return true if the object represents a truth value, false otherwise.
For bool and numeric objects, uses Python's built-in bool function. For
str objects, checks string against a list of possible truth values.
Args:
obj: object to determine boolean value of; expected
Returns:
... | python | def parse_bool(obj):
"""Return true if the object represents a truth value, false otherwise.
For bool and numeric objects, uses Python's built-in bool function. For
str objects, checks string against a list of possible truth values.
Args:
obj: object to determine boolean value of; expected
Returns:
... | [
"def",
"parse_bool",
"(",
"obj",
")",
":",
"if",
"type",
"(",
"obj",
")",
"is",
"str",
":",
"TRUTH_VALUE_SET",
"=",
"[",
"\"true\"",
",",
"\"1\"",
",",
"\"yes\"",
",",
"\"t\"",
",",
"\"on\"",
"]",
"return",
"obj",
".",
"lower",
"(",
")",
"in",
"TRU... | Return true if the object represents a truth value, false otherwise.
For bool and numeric objects, uses Python's built-in bool function. For
str objects, checks string against a list of possible truth values.
Args:
obj: object to determine boolean value of; expected
Returns:
Boolean value according ... | [
"Return",
"true",
"if",
"the",
"object",
"represents",
"a",
"truth",
"value",
"false",
"otherwise",
"."
] | 2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6 | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/util.py#L333-L352 | train | Returns true if the object represents a truth value false otherwise. | 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/util.py | create_datastore_write_config | def create_datastore_write_config(mapreduce_spec):
"""Creates datastore config to use in write operations.
Args:
mapreduce_spec: current mapreduce specification as MapreduceSpec.
Returns:
an instance of datastore_rpc.Configuration to use for all write
operations in the mapreduce.
"""
force_write... | python | def create_datastore_write_config(mapreduce_spec):
"""Creates datastore config to use in write operations.
Args:
mapreduce_spec: current mapreduce specification as MapreduceSpec.
Returns:
an instance of datastore_rpc.Configuration to use for all write
operations in the mapreduce.
"""
force_write... | [
"def",
"create_datastore_write_config",
"(",
"mapreduce_spec",
")",
":",
"force_writes",
"=",
"parse_bool",
"(",
"mapreduce_spec",
".",
"params",
".",
"get",
"(",
"\"force_writes\"",
",",
"\"false\"",
")",
")",
"if",
"force_writes",
":",
"return",
"datastore_rpc",
... | Creates datastore config to use in write operations.
Args:
mapreduce_spec: current mapreduce specification as MapreduceSpec.
Returns:
an instance of datastore_rpc.Configuration to use for all write
operations in the mapreduce. | [
"Creates",
"datastore",
"config",
"to",
"use",
"in",
"write",
"operations",
"."
] | 2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6 | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/util.py#L355-L370 | train | Creates datastore config to use in write operations. | 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/util.py | _set_ndb_cache_policy | def _set_ndb_cache_policy():
"""Tell NDB to never cache anything in memcache or in-process.
This ensures that entities fetched from Datastore input_readers via NDB
will not bloat up the request memory size and Datastore Puts will avoid
doing calls to memcache. Without this you get soft memory limit exits,
wh... | python | def _set_ndb_cache_policy():
"""Tell NDB to never cache anything in memcache or in-process.
This ensures that entities fetched from Datastore input_readers via NDB
will not bloat up the request memory size and Datastore Puts will avoid
doing calls to memcache. Without this you get soft memory limit exits,
wh... | [
"def",
"_set_ndb_cache_policy",
"(",
")",
":",
"ndb_ctx",
"=",
"ndb",
".",
"get_context",
"(",
")",
"ndb_ctx",
".",
"set_cache_policy",
"(",
"lambda",
"key",
":",
"False",
")",
"ndb_ctx",
".",
"set_memcache_policy",
"(",
"lambda",
"key",
":",
"False",
")"
] | Tell NDB to never cache anything in memcache or in-process.
This ensures that entities fetched from Datastore input_readers via NDB
will not bloat up the request memory size and Datastore Puts will avoid
doing calls to memcache. Without this you get soft memory limit exits,
which hurts overall throughput. | [
"Tell",
"NDB",
"to",
"never",
"cache",
"anything",
"in",
"memcache",
"or",
"in",
"-",
"process",
"."
] | 2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6 | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/util.py#L373-L383 | train | Tell NDB to never cache anything in memcache or in - process. | 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/util.py | _obj_to_path | def _obj_to_path(obj):
"""Returns the fully qualified path to the object.
Args:
obj: obj must be a new style top level class, or a top level function.
No inner function or static method.
Returns:
Fully qualified path to the object.
Raises:
TypeError: when argument obj has unsupported type.
... | python | def _obj_to_path(obj):
"""Returns the fully qualified path to the object.
Args:
obj: obj must be a new style top level class, or a top level function.
No inner function or static method.
Returns:
Fully qualified path to the object.
Raises:
TypeError: when argument obj has unsupported type.
... | [
"def",
"_obj_to_path",
"(",
"obj",
")",
":",
"if",
"obj",
"is",
"None",
":",
"return",
"obj",
"if",
"inspect",
".",
"isclass",
"(",
"obj",
")",
"or",
"inspect",
".",
"isfunction",
"(",
"obj",
")",
":",
"fetched",
"=",
"getattr",
"(",
"sys",
".",
"m... | Returns the fully qualified path to the object.
Args:
obj: obj must be a new style top level class, or a top level function.
No inner function or static method.
Returns:
Fully qualified path to the object.
Raises:
TypeError: when argument obj has unsupported type.
ValueError: when obj can... | [
"Returns",
"the",
"fully",
"qualified",
"path",
"to",
"the",
"object",
"."
] | 2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6 | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/util.py#L386-L409 | train | Returns the fully qualified path to the 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/util.py | strip_prefix_from_items | def strip_prefix_from_items(prefix, items):
"""Strips out the prefix from each of the items if it is present.
Args:
prefix: the string for that you wish to strip from the beginning of each
of the items.
items: a list of strings that may or may not contain the prefix you want
to strip out.
Re... | python | def strip_prefix_from_items(prefix, items):
"""Strips out the prefix from each of the items if it is present.
Args:
prefix: the string for that you wish to strip from the beginning of each
of the items.
items: a list of strings that may or may not contain the prefix you want
to strip out.
Re... | [
"def",
"strip_prefix_from_items",
"(",
"prefix",
",",
"items",
")",
":",
"items_no_prefix",
"=",
"[",
"]",
"for",
"item",
"in",
"items",
":",
"if",
"item",
".",
"startswith",
"(",
"prefix",
")",
":",
"items_no_prefix",
".",
"append",
"(",
"item",
"[",
"l... | Strips out the prefix from each of the items if it is present.
Args:
prefix: the string for that you wish to strip from the beginning of each
of the items.
items: a list of strings that may or may not contain the prefix you want
to strip out.
Returns:
items_no_prefix: a copy of the list of... | [
"Strips",
"out",
"the",
"prefix",
"from",
"each",
"of",
"the",
"items",
"if",
"it",
"is",
"present",
"."
] | 2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6 | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/util.py#L412-L431 | train | Strips out the prefix from each of the items if it is present. | 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/handlers.py | _run_task_hook | def _run_task_hook(hooks, method, task, queue_name):
"""Invokes hooks.method(task, queue_name).
Args:
hooks: A hooks.Hooks instance or None.
method: The name of the method to invoke on the hooks class e.g.
"enqueue_kickoff_task".
task: The taskqueue.Task to pass to the hook method.
queue_na... | python | def _run_task_hook(hooks, method, task, queue_name):
"""Invokes hooks.method(task, queue_name).
Args:
hooks: A hooks.Hooks instance or None.
method: The name of the method to invoke on the hooks class e.g.
"enqueue_kickoff_task".
task: The taskqueue.Task to pass to the hook method.
queue_na... | [
"def",
"_run_task_hook",
"(",
"hooks",
",",
"method",
",",
"task",
",",
"queue_name",
")",
":",
"if",
"hooks",
"is",
"not",
"None",
":",
"try",
":",
"getattr",
"(",
"hooks",
",",
"method",
")",
"(",
"task",
",",
"queue_name",
")",
"except",
"NotImpleme... | Invokes hooks.method(task, queue_name).
Args:
hooks: A hooks.Hooks instance or None.
method: The name of the method to invoke on the hooks class e.g.
"enqueue_kickoff_task".
task: The taskqueue.Task to pass to the hook method.
queue_name: The name of the queue to pass to the hook method.
R... | [
"Invokes",
"hooks",
".",
"method",
"(",
"task",
"queue_name",
")",
"."
] | 2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6 | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/handlers.py#L85-L106 | train | Invokes the method on the taskqueue. Task object 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/handlers.py | MapperWorkerCallbackHandler._drop_gracefully | def _drop_gracefully(self):
"""Drop worker task gracefully.
Set current shard_state to failed. Controller logic will take care of
other shards and the entire MR.
"""
shard_id = self.request.headers[util._MR_SHARD_ID_TASK_HEADER]
mr_id = self.request.headers[util._MR_ID_TASK_HEADER]
shard_st... | python | def _drop_gracefully(self):
"""Drop worker task gracefully.
Set current shard_state to failed. Controller logic will take care of
other shards and the entire MR.
"""
shard_id = self.request.headers[util._MR_SHARD_ID_TASK_HEADER]
mr_id = self.request.headers[util._MR_ID_TASK_HEADER]
shard_st... | [
"def",
"_drop_gracefully",
"(",
"self",
")",
":",
"shard_id",
"=",
"self",
".",
"request",
".",
"headers",
"[",
"util",
".",
"_MR_SHARD_ID_TASK_HEADER",
"]",
"mr_id",
"=",
"self",
".",
"request",
".",
"headers",
"[",
"util",
".",
"_MR_ID_TASK_HEADER",
"]",
... | Drop worker task gracefully.
Set current shard_state to failed. Controller logic will take care of
other shards and the entire MR. | [
"Drop",
"worker",
"task",
"gracefully",
"."
] | 2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6 | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/handlers.py#L140-L155 | train | Drop worker task gracefully. | 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/handlers.py | MapperWorkerCallbackHandler._try_acquire_lease | def _try_acquire_lease(self, shard_state, tstate):
"""Validate datastore and the task payload are consistent.
If so, attempt to get a lease on this slice's execution.
See model.ShardState doc on slice_start_time.
Args:
shard_state: model.ShardState from datastore.
tstate: model.TransientSh... | python | def _try_acquire_lease(self, shard_state, tstate):
"""Validate datastore and the task payload are consistent.
If so, attempt to get a lease on this slice's execution.
See model.ShardState doc on slice_start_time.
Args:
shard_state: model.ShardState from datastore.
tstate: model.TransientSh... | [
"def",
"_try_acquire_lease",
"(",
"self",
",",
"shard_state",
",",
"tstate",
")",
":",
"# Controller will tally shard_states and properly handle the situation.",
"if",
"not",
"shard_state",
":",
"logging",
".",
"warning",
"(",
"\"State not found for shard %s; Possible spurious ... | Validate datastore and the task payload are consistent.
If so, attempt to get a lease on this slice's execution.
See model.ShardState doc on slice_start_time.
Args:
shard_state: model.ShardState from datastore.
tstate: model.TransientShardState from taskqueue paylod.
Returns:
A _TAS... | [
"Validate",
"datastore",
"and",
"the",
"task",
"payload",
"are",
"consistent",
"."
] | 2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6 | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/handlers.py#L157-L288 | train | Checks if the lease is available and if so attempts to get it. | 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/handlers.py | MapperWorkerCallbackHandler._has_old_request_ended | def _has_old_request_ended(self, shard_state):
"""Whether previous slice retry has ended according to Logs API.
Args:
shard_state: shard state.
Returns:
True if the request of previous slice retry has ended. False if it has
not or unknown.
"""
assert shard_state.slice_start_time is... | python | def _has_old_request_ended(self, shard_state):
"""Whether previous slice retry has ended according to Logs API.
Args:
shard_state: shard state.
Returns:
True if the request of previous slice retry has ended. False if it has
not or unknown.
"""
assert shard_state.slice_start_time is... | [
"def",
"_has_old_request_ended",
"(",
"self",
",",
"shard_state",
")",
":",
"assert",
"shard_state",
".",
"slice_start_time",
"is",
"not",
"None",
"assert",
"shard_state",
".",
"slice_request_id",
"is",
"not",
"None",
"request_ids",
"=",
"[",
"shard_state",
".",
... | Whether previous slice retry has ended according to Logs API.
Args:
shard_state: shard state.
Returns:
True if the request of previous slice retry has ended. False if it has
not or unknown. | [
"Whether",
"previous",
"slice",
"retry",
"has",
"ended",
"according",
"to",
"Logs",
"API",
"."
] | 2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6 | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/handlers.py#L290-L314 | train | Returns True if the previous slice retry has ended according to Logs 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/handlers.py | MapperWorkerCallbackHandler._wait_time | def _wait_time(self, shard_state, secs, now=datetime.datetime.now):
"""Time to wait until slice_start_time is secs ago from now.
Args:
shard_state: shard state.
secs: duration in seconds.
now: a func that gets now.
Returns:
0 if no wait. A positive int in seconds otherwise. Always ... | python | def _wait_time(self, shard_state, secs, now=datetime.datetime.now):
"""Time to wait until slice_start_time is secs ago from now.
Args:
shard_state: shard state.
secs: duration in seconds.
now: a func that gets now.
Returns:
0 if no wait. A positive int in seconds otherwise. Always ... | [
"def",
"_wait_time",
"(",
"self",
",",
"shard_state",
",",
"secs",
",",
"now",
"=",
"datetime",
".",
"datetime",
".",
"now",
")",
":",
"assert",
"shard_state",
".",
"slice_start_time",
"is",
"not",
"None",
"delta",
"=",
"now",
"(",
")",
"-",
"shard_state... | Time to wait until slice_start_time is secs ago from now.
Args:
shard_state: shard state.
secs: duration in seconds.
now: a func that gets now.
Returns:
0 if no wait. A positive int in seconds otherwise. Always around up. | [
"Time",
"to",
"wait",
"until",
"slice_start_time",
"is",
"secs",
"ago",
"from",
"now",
"."
] | 2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6 | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/handlers.py#L316-L333 | train | Time to wait until slice_start_time is secs ago from now. | 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/handlers.py | MapperWorkerCallbackHandler._try_free_lease | def _try_free_lease(self, shard_state, slice_retry=False):
"""Try to free lease.
A lightweight transaction to update shard_state and unset
slice_start_time to allow the next retry to happen without blocking.
We don't care if this fails or not because the lease will expire
anyway.
Under normal ... | python | def _try_free_lease(self, shard_state, slice_retry=False):
"""Try to free lease.
A lightweight transaction to update shard_state and unset
slice_start_time to allow the next retry to happen without blocking.
We don't care if this fails or not because the lease will expire
anyway.
Under normal ... | [
"def",
"_try_free_lease",
"(",
"self",
",",
"shard_state",
",",
"slice_retry",
"=",
"False",
")",
":",
"@",
"db",
".",
"transactional",
"def",
"_tx",
"(",
")",
":",
"fresh_state",
"=",
"model",
".",
"ShardState",
".",
"get_by_shard_id",
"(",
"shard_state",
... | Try to free lease.
A lightweight transaction to update shard_state and unset
slice_start_time to allow the next retry to happen without blocking.
We don't care if this fails or not because the lease will expire
anyway.
Under normal execution, _save_state_and_schedule_next is the exit point.
It... | [
"Try",
"to",
"free",
"lease",
"."
] | 2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6 | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/handlers.py#L335-L376 | train | Try to free a lease. | 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/handlers.py | MapperWorkerCallbackHandler._maintain_LC | def _maintain_LC(self, obj, slice_id, last_slice=False, begin_slice=True,
shard_ctx=None, slice_ctx=None):
"""Makes sure shard life cycle interface are respected.
Args:
obj: the obj that may have implemented _ShardLifeCycle.
slice_id: current slice_id
last_slice: whether th... | python | def _maintain_LC(self, obj, slice_id, last_slice=False, begin_slice=True,
shard_ctx=None, slice_ctx=None):
"""Makes sure shard life cycle interface are respected.
Args:
obj: the obj that may have implemented _ShardLifeCycle.
slice_id: current slice_id
last_slice: whether th... | [
"def",
"_maintain_LC",
"(",
"self",
",",
"obj",
",",
"slice_id",
",",
"last_slice",
"=",
"False",
",",
"begin_slice",
"=",
"True",
",",
"shard_ctx",
"=",
"None",
",",
"slice_ctx",
"=",
"None",
")",
":",
"if",
"obj",
"is",
"None",
"or",
"not",
"isinstan... | Makes sure shard life cycle interface are respected.
Args:
obj: the obj that may have implemented _ShardLifeCycle.
slice_id: current slice_id
last_slice: whether this is the last slice.
begin_slice: whether this is the beginning or the end of a slice.
shard_ctx: shard ctx for dependen... | [
"Makes",
"sure",
"shard",
"life",
"cycle",
"interface",
"are",
"respected",
"."
] | 2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6 | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/handlers.py#L378-L404 | train | Makes sure shard life cycle interface are respected. | 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/handlers.py | MapperWorkerCallbackHandler.handle | def handle(self):
"""Handle request.
This method has to be careful to pass the same ShardState instance to
its subroutines calls if the calls mutate or read from ShardState.
Note especially that Context instance caches and updates the ShardState
instance.
Returns:
Set HTTP status code an... | python | def handle(self):
"""Handle request.
This method has to be careful to pass the same ShardState instance to
its subroutines calls if the calls mutate or read from ShardState.
Note especially that Context instance caches and updates the ShardState
instance.
Returns:
Set HTTP status code an... | [
"def",
"handle",
"(",
"self",
")",
":",
"# Reconstruct basic states.",
"self",
".",
"_start_time",
"=",
"self",
".",
"_time",
"(",
")",
"shard_id",
"=",
"self",
".",
"request",
".",
"headers",
"[",
"util",
".",
"_MR_SHARD_ID_TASK_HEADER",
"]",
"mr_id",
"=",
... | Handle request.
This method has to be careful to pass the same ShardState instance to
its subroutines calls if the calls mutate or read from ShardState.
Note especially that Context instance caches and updates the ShardState
instance.
Returns:
Set HTTP status code and always returns None. | [
"Handle",
"request",
"."
] | 2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6 | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/handlers.py#L419-L526 | train | Handle the 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/handlers.py | MapperWorkerCallbackHandler.__return | def __return(self, shard_state, tstate, task_directive):
"""Handler should always call this as the last statement."""
task_directive = self._set_state(shard_state, tstate, task_directive)
self._save_state_and_schedule_next(shard_state, tstate, task_directive)
context.Context._set(None) | python | def __return(self, shard_state, tstate, task_directive):
"""Handler should always call this as the last statement."""
task_directive = self._set_state(shard_state, tstate, task_directive)
self._save_state_and_schedule_next(shard_state, tstate, task_directive)
context.Context._set(None) | [
"def",
"__return",
"(",
"self",
",",
"shard_state",
",",
"tstate",
",",
"task_directive",
")",
":",
"task_directive",
"=",
"self",
".",
"_set_state",
"(",
"shard_state",
",",
"tstate",
",",
"task_directive",
")",
"self",
".",
"_save_state_and_schedule_next",
"("... | Handler should always call this as the last statement. | [
"Handler",
"should",
"always",
"call",
"this",
"as",
"the",
"last",
"statement",
"."
] | 2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6 | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/handlers.py#L528-L532 | train | Handler should always call this as the last statement. | 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/handlers.py | MapperWorkerCallbackHandler._process_inputs | def _process_inputs(self,
input_reader,
shard_state,
tstate,
ctx):
"""Read inputs, process them, and write out outputs.
This is the core logic of MapReduce. It reads inputs from input reader,
invokes user specified mapp... | python | def _process_inputs(self,
input_reader,
shard_state,
tstate,
ctx):
"""Read inputs, process them, and write out outputs.
This is the core logic of MapReduce. It reads inputs from input reader,
invokes user specified mapp... | [
"def",
"_process_inputs",
"(",
"self",
",",
"input_reader",
",",
"shard_state",
",",
"tstate",
",",
"ctx",
")",
":",
"processing_limit",
"=",
"self",
".",
"_processing_limit",
"(",
"tstate",
".",
"mapreduce_spec",
")",
"if",
"processing_limit",
"==",
"0",
":",... | Read inputs, process them, and write out outputs.
This is the core logic of MapReduce. It reads inputs from input reader,
invokes user specified mapper function, and writes output with
output writer. It also updates shard_state accordingly.
e.g. if shard processing is done, set shard_state.active to Fa... | [
"Read",
"inputs",
"process",
"them",
"and",
"write",
"out",
"outputs",
"."
] | 2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6 | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/handlers.py#L534-L605 | train | Read inputs process them and write out outputs. | 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/handlers.py | MapperWorkerCallbackHandler._process_datum | def _process_datum(self, data, input_reader, ctx, transient_shard_state):
"""Process a single data piece.
Call mapper handler on the data.
Args:
data: a datum to process.
input_reader: input reader.
ctx: mapreduce context
transient_shard_state: transient shard state.
Returns:
... | python | def _process_datum(self, data, input_reader, ctx, transient_shard_state):
"""Process a single data piece.
Call mapper handler on the data.
Args:
data: a datum to process.
input_reader: input reader.
ctx: mapreduce context
transient_shard_state: transient shard state.
Returns:
... | [
"def",
"_process_datum",
"(",
"self",
",",
"data",
",",
"input_reader",
",",
"ctx",
",",
"transient_shard_state",
")",
":",
"if",
"data",
"is",
"not",
"input_readers",
".",
"ALLOW_CHECKPOINT",
":",
"self",
".",
"slice_context",
".",
"incr",
"(",
"context",
"... | Process a single data piece.
Call mapper handler on the data.
Args:
data: a datum to process.
input_reader: input reader.
ctx: mapreduce context
transient_shard_state: transient shard state.
Returns:
True if scan should be continued, False if scan should be stopped. | [
"Process",
"a",
"single",
"data",
"piece",
"."
] | 2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6 | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/handlers.py#L607-L648 | train | Process a single data piece. | 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/handlers.py | MapperWorkerCallbackHandler._set_state | def _set_state(self, shard_state, tstate, task_directive):
"""Set shard_state and tstate based on task_directive.
Args:
shard_state: model.ShardState for current shard.
tstate: model.TransientShardState for current shard.
task_directive: self._TASK_DIRECTIVE for current shard.
Returns:
... | python | def _set_state(self, shard_state, tstate, task_directive):
"""Set shard_state and tstate based on task_directive.
Args:
shard_state: model.ShardState for current shard.
tstate: model.TransientShardState for current shard.
task_directive: self._TASK_DIRECTIVE for current shard.
Returns:
... | [
"def",
"_set_state",
"(",
"self",
",",
"shard_state",
",",
"tstate",
",",
"task_directive",
")",
":",
"if",
"task_directive",
"in",
"(",
"self",
".",
"_TASK_DIRECTIVE",
".",
"RETRY_TASK",
",",
"self",
".",
"_TASK_DIRECTIVE",
".",
"DROP_TASK",
")",
":",
"retu... | Set shard_state and tstate based on task_directive.
Args:
shard_state: model.ShardState for current shard.
tstate: model.TransientShardState for current shard.
task_directive: self._TASK_DIRECTIVE for current shard.
Returns:
A _TASK_DIRECTIVE enum.
PROCEED_TASK if task should pro... | [
"Set",
"shard_state",
"and",
"tstate",
"based",
"on",
"task_directive",
"."
] | 2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6 | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/handlers.py#L650-L694 | train | Sets the shard_state and tstate based on task_directive. | 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/handlers.py | MapperWorkerCallbackHandler._save_state_and_schedule_next | def _save_state_and_schedule_next(self, shard_state, tstate, task_directive):
"""Save state and schedule task.
Save shard state to datastore.
Schedule next slice if needed.
Set HTTP response code.
No modification to any shard_state or tstate.
Args:
shard_state: model.ShardState for curre... | python | def _save_state_and_schedule_next(self, shard_state, tstate, task_directive):
"""Save state and schedule task.
Save shard state to datastore.
Schedule next slice if needed.
Set HTTP response code.
No modification to any shard_state or tstate.
Args:
shard_state: model.ShardState for curre... | [
"def",
"_save_state_and_schedule_next",
"(",
"self",
",",
"shard_state",
",",
"tstate",
",",
"task_directive",
")",
":",
"spec",
"=",
"tstate",
".",
"mapreduce_spec",
"if",
"task_directive",
"==",
"self",
".",
"_TASK_DIRECTIVE",
".",
"DROP_TASK",
":",
"return",
... | Save state and schedule task.
Save shard state to datastore.
Schedule next slice if needed.
Set HTTP response code.
No modification to any shard_state or tstate.
Args:
shard_state: model.ShardState for current shard.
tstate: model.TransientShardState for current shard.
task_direc... | [
"Save",
"state",
"and",
"schedule",
"task",
"."
] | 2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6 | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/handlers.py#L696-L786 | train | Save state and schedule next slice if needed. | 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/handlers.py | MapperWorkerCallbackHandler._attempt_slice_recovery | def _attempt_slice_recovery(self, shard_state, tstate):
"""Recover a slice.
This is run when a slice had been previously attempted and output
may have been written. If an output writer requires slice recovery,
we run those logic to remove output duplicates. Otherwise we just retry
the slice.
I... | python | def _attempt_slice_recovery(self, shard_state, tstate):
"""Recover a slice.
This is run when a slice had been previously attempted and output
may have been written. If an output writer requires slice recovery,
we run those logic to remove output duplicates. Otherwise we just retry
the slice.
I... | [
"def",
"_attempt_slice_recovery",
"(",
"self",
",",
"shard_state",
",",
"tstate",
")",
":",
"mapper_spec",
"=",
"tstate",
".",
"mapreduce_spec",
".",
"mapper",
"if",
"not",
"(",
"tstate",
".",
"output_writer",
"and",
"tstate",
".",
"output_writer",
".",
"_supp... | Recover a slice.
This is run when a slice had been previously attempted and output
may have been written. If an output writer requires slice recovery,
we run those logic to remove output duplicates. Otherwise we just retry
the slice.
If recovery is needed, then the entire slice will be dedicated
... | [
"Recover",
"a",
"slice",
"."
] | 2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6 | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/handlers.py#L788-L826 | train | This function is called by _process_slice_recovery_task to recover a slice. This is called by _process_slice_recovery_task_retry_task to retry the slice recovery. | 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/handlers.py | MapperWorkerCallbackHandler._attempt_shard_retry | def _attempt_shard_retry(self, shard_state, tstate):
"""Whether to retry shard.
This method may modify shard_state and tstate to prepare for retry or fail.
Args:
shard_state: model.ShardState for current shard.
tstate: model.TransientShardState for current shard.
Returns:
A _TASK_DI... | python | def _attempt_shard_retry(self, shard_state, tstate):
"""Whether to retry shard.
This method may modify shard_state and tstate to prepare for retry or fail.
Args:
shard_state: model.ShardState for current shard.
tstate: model.TransientShardState for current shard.
Returns:
A _TASK_DI... | [
"def",
"_attempt_shard_retry",
"(",
"self",
",",
"shard_state",
",",
"tstate",
")",
":",
"shard_attempts",
"=",
"shard_state",
".",
"retries",
"+",
"1",
"if",
"shard_attempts",
">=",
"parameters",
".",
"config",
".",
"SHARD_MAX_ATTEMPTS",
":",
"logging",
".",
... | Whether to retry shard.
This method may modify shard_state and tstate to prepare for retry or fail.
Args:
shard_state: model.ShardState for current shard.
tstate: model.TransientShardState for current shard.
Returns:
A _TASK_DIRECTIVE enum. RETRY_SHARD if shard should be retried.
FA... | [
"Whether",
"to",
"retry",
"shard",
"."
] | 2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6 | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/handlers.py#L828-L864 | train | This method attempts to retry 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/handlers.py | MapperWorkerCallbackHandler._attempt_slice_retry | def _attempt_slice_retry(self, shard_state, tstate):
"""Attempt to retry this slice.
This method may modify shard_state and tstate to prepare for retry or fail.
Args:
shard_state: model.ShardState for current shard.
tstate: model.TransientShardState for current shard.
Returns:
A _TA... | python | def _attempt_slice_retry(self, shard_state, tstate):
"""Attempt to retry this slice.
This method may modify shard_state and tstate to prepare for retry or fail.
Args:
shard_state: model.ShardState for current shard.
tstate: model.TransientShardState for current shard.
Returns:
A _TA... | [
"def",
"_attempt_slice_retry",
"(",
"self",
",",
"shard_state",
",",
"tstate",
")",
":",
"if",
"(",
"shard_state",
".",
"slice_retries",
"+",
"1",
"<",
"parameters",
".",
"config",
".",
"TASK_MAX_DATA_PROCESSING_ATTEMPTS",
")",
":",
"logging",
".",
"warning",
... | Attempt to retry this slice.
This method may modify shard_state and tstate to prepare for retry or fail.
Args:
shard_state: model.ShardState for current shard.
tstate: model.TransientShardState for current shard.
Returns:
A _TASK_DIRECTIVE enum. RETRY_SLICE if slice should be retried.
... | [
"Attempt",
"to",
"retry",
"this",
"slice",
"."
] | 2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6 | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/handlers.py#L866-L902 | train | Attempts to retry this 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/handlers.py | MapperWorkerCallbackHandler._get_countdown_for_next_slice | def _get_countdown_for_next_slice(self, spec):
"""Get countdown for next slice's task.
When user sets processing rate, we set countdown to delay task execution.
Args:
spec: model.MapreduceSpec
Returns:
countdown in int.
"""
countdown = 0
if self._processing_limit(spec) != -1:
... | python | def _get_countdown_for_next_slice(self, spec):
"""Get countdown for next slice's task.
When user sets processing rate, we set countdown to delay task execution.
Args:
spec: model.MapreduceSpec
Returns:
countdown in int.
"""
countdown = 0
if self._processing_limit(spec) != -1:
... | [
"def",
"_get_countdown_for_next_slice",
"(",
"self",
",",
"spec",
")",
":",
"countdown",
"=",
"0",
"if",
"self",
".",
"_processing_limit",
"(",
"spec",
")",
"!=",
"-",
"1",
":",
"countdown",
"=",
"max",
"(",
"int",
"(",
"parameters",
".",
"config",
".",
... | Get countdown for next slice's task.
When user sets processing rate, we set countdown to delay task execution.
Args:
spec: model.MapreduceSpec
Returns:
countdown in int. | [
"Get",
"countdown",
"for",
"next",
"slice",
"s",
"task",
"."
] | 2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6 | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/handlers.py#L921-L937 | train | Get countdown for next slice s 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/handlers.py | MapperWorkerCallbackHandler._state_to_task | def _state_to_task(cls,
tstate,
shard_state,
eta=None,
countdown=None):
"""Generate task for slice according to current states.
Args:
tstate: An instance of TransientShardState.
shard_state: An instance of ShardStat... | python | def _state_to_task(cls,
tstate,
shard_state,
eta=None,
countdown=None):
"""Generate task for slice according to current states.
Args:
tstate: An instance of TransientShardState.
shard_state: An instance of ShardStat... | [
"def",
"_state_to_task",
"(",
"cls",
",",
"tstate",
",",
"shard_state",
",",
"eta",
"=",
"None",
",",
"countdown",
"=",
"None",
")",
":",
"base_path",
"=",
"tstate",
".",
"base_path",
"task_name",
"=",
"MapperWorkerCallbackHandler",
".",
"get_task_name",
"(",
... | Generate task for slice according to current states.
Args:
tstate: An instance of TransientShardState.
shard_state: An instance of ShardState.
eta: Absolute time when the MR should execute. May not be specified
if 'countdown' is also supplied. This may be timezone-aware or
timezon... | [
"Generate",
"task",
"for",
"slice",
"according",
"to",
"current",
"states",
"."
] | 2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6 | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/handlers.py#L940-L977 | train | Generate a HugeTask instance for the given 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/handlers.py | MapperWorkerCallbackHandler._add_task | def _add_task(cls,
worker_task,
mapreduce_spec,
queue_name):
"""Schedule slice scanning by adding it to the task queue.
Args:
worker_task: a model.HugeTask task for slice. This is NOT a taskqueue
task.
mapreduce_spec: an instance of model.Mapr... | python | def _add_task(cls,
worker_task,
mapreduce_spec,
queue_name):
"""Schedule slice scanning by adding it to the task queue.
Args:
worker_task: a model.HugeTask task for slice. This is NOT a taskqueue
task.
mapreduce_spec: an instance of model.Mapr... | [
"def",
"_add_task",
"(",
"cls",
",",
"worker_task",
",",
"mapreduce_spec",
",",
"queue_name",
")",
":",
"if",
"not",
"_run_task_hook",
"(",
"mapreduce_spec",
".",
"get_hooks",
"(",
")",
",",
"\"enqueue_worker_task\"",
",",
"worker_task",
",",
"queue_name",
")",
... | Schedule slice scanning by adding it to the task queue.
Args:
worker_task: a model.HugeTask task for slice. This is NOT a taskqueue
task.
mapreduce_spec: an instance of model.MapreduceSpec.
queue_name: Optional queue to run on; uses the current queue of
execution or the default qu... | [
"Schedule",
"slice",
"scanning",
"by",
"adding",
"it",
"to",
"the",
"task",
"queue",
"."
] | 2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6 | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/handlers.py#L980-L1006 | train | Add a task to 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... |
GoogleCloudPlatform/appengine-mapreduce | python/src/mapreduce/handlers.py | MapperWorkerCallbackHandler._processing_limit | def _processing_limit(self, spec):
"""Get the limit on the number of map calls allowed by this slice.
Args:
spec: a Mapreduce spec.
Returns:
The limit as a positive int if specified by user. -1 otherwise.
"""
processing_rate = float(spec.mapper.params.get("processing_rate", 0))
sli... | python | def _processing_limit(self, spec):
"""Get the limit on the number of map calls allowed by this slice.
Args:
spec: a Mapreduce spec.
Returns:
The limit as a positive int if specified by user. -1 otherwise.
"""
processing_rate = float(spec.mapper.params.get("processing_rate", 0))
sli... | [
"def",
"_processing_limit",
"(",
"self",
",",
"spec",
")",
":",
"processing_rate",
"=",
"float",
"(",
"spec",
".",
"mapper",
".",
"params",
".",
"get",
"(",
"\"processing_rate\"",
",",
"0",
")",
")",
"slice_processing_limit",
"=",
"-",
"1",
"if",
"processi... | Get the limit on the number of map calls allowed by this slice.
Args:
spec: a Mapreduce spec.
Returns:
The limit as a positive int if specified by user. -1 otherwise. | [
"Get",
"the",
"limit",
"on",
"the",
"number",
"of",
"map",
"calls",
"allowed",
"by",
"this",
"slice",
"."
] | 2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6 | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/handlers.py#L1008-L1023 | train | Get the limit on the number of map calls allowed by this 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/handlers.py | MapperWorkerCallbackHandler._schedule_slice | def _schedule_slice(cls,
shard_state,
tstate,
queue_name=None,
eta=None,
countdown=None):
"""Schedule slice scanning by adding it to the task queue.
Args:
shard_state: An instance of ShardState.
... | python | def _schedule_slice(cls,
shard_state,
tstate,
queue_name=None,
eta=None,
countdown=None):
"""Schedule slice scanning by adding it to the task queue.
Args:
shard_state: An instance of ShardState.
... | [
"def",
"_schedule_slice",
"(",
"cls",
",",
"shard_state",
",",
"tstate",
",",
"queue_name",
"=",
"None",
",",
"eta",
"=",
"None",
",",
"countdown",
"=",
"None",
")",
":",
"queue_name",
"=",
"queue_name",
"or",
"os",
".",
"environ",
".",
"get",
"(",
"\"... | Schedule slice scanning by adding it to the task queue.
Args:
shard_state: An instance of ShardState.
tstate: An instance of TransientShardState.
queue_name: Optional queue to run on; uses the current queue of
execution or the default queue if unspecified.
eta: Absolute time when th... | [
"Schedule",
"slice",
"scanning",
"by",
"adding",
"it",
"to",
"the",
"task",
"queue",
"."
] | 2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6 | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/handlers.py#L1028-L1050 | train | Schedules a slice of the MR. | 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/handlers.py | ControllerCallbackHandler._drop_gracefully | def _drop_gracefully(self):
"""Gracefully drop controller task.
This method is called when decoding controller task payload failed.
Upon this we mark ShardState and MapreduceState as failed so all
tasks can stop.
Writing to datastore is forced (ignore read-only mode) because we
want the tasks ... | python | def _drop_gracefully(self):
"""Gracefully drop controller task.
This method is called when decoding controller task payload failed.
Upon this we mark ShardState and MapreduceState as failed so all
tasks can stop.
Writing to datastore is forced (ignore read-only mode) because we
want the tasks ... | [
"def",
"_drop_gracefully",
"(",
"self",
")",
":",
"mr_id",
"=",
"self",
".",
"request",
".",
"headers",
"[",
"util",
".",
"_MR_ID_TASK_HEADER",
"]",
"state",
"=",
"model",
".",
"MapreduceState",
".",
"get_by_job_id",
"(",
"mr_id",
")",
"if",
"not",
"state"... | Gracefully drop controller task.
This method is called when decoding controller task payload failed.
Upon this we mark ShardState and MapreduceState as failed so all
tasks can stop.
Writing to datastore is forced (ignore read-only mode) because we
want the tasks to stop badly, and if force_writes ... | [
"Gracefully",
"drop",
"controller",
"task",
"."
] | 2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6 | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/handlers.py#L1068-L1098 | train | Gracefully drop controller 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/handlers.py | ControllerCallbackHandler.handle | def handle(self):
"""Handle request."""
spec = model.MapreduceSpec.from_json_str(
self.request.get("mapreduce_spec"))
state, control = db.get([
model.MapreduceState.get_key_by_job_id(spec.mapreduce_id),
model.MapreduceControl.get_key_by_job_id(spec.mapreduce_id),
])
if not s... | python | def handle(self):
"""Handle request."""
spec = model.MapreduceSpec.from_json_str(
self.request.get("mapreduce_spec"))
state, control = db.get([
model.MapreduceState.get_key_by_job_id(spec.mapreduce_id),
model.MapreduceControl.get_key_by_job_id(spec.mapreduce_id),
])
if not s... | [
"def",
"handle",
"(",
"self",
")",
":",
"spec",
"=",
"model",
".",
"MapreduceSpec",
".",
"from_json_str",
"(",
"self",
".",
"request",
".",
"get",
"(",
"\"mapreduce_spec\"",
")",
")",
"state",
",",
"control",
"=",
"db",
".",
"get",
"(",
"[",
"model",
... | Handle request. | [
"Handle",
"request",
"."
] | 2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6 | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/handlers.py#L1100-L1125 | train | Handle the 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/handlers.py | ControllerCallbackHandler._update_state_from_shard_states | def _update_state_from_shard_states(self, state, shard_states, control):
"""Update mr state by examing shard states.
Args:
state: current mapreduce state as MapreduceState.
shard_states: an iterator over shard states.
control: model.MapreduceControl entity.
"""
# Initialize vars.
... | python | def _update_state_from_shard_states(self, state, shard_states, control):
"""Update mr state by examing shard states.
Args:
state: current mapreduce state as MapreduceState.
shard_states: an iterator over shard states.
control: model.MapreduceControl entity.
"""
# Initialize vars.
... | [
"def",
"_update_state_from_shard_states",
"(",
"self",
",",
"state",
",",
"shard_states",
",",
"control",
")",
":",
"# Initialize vars.",
"state",
".",
"active_shards",
",",
"state",
".",
"aborted_shards",
",",
"state",
".",
"failed_shards",
"=",
"0",
",",
"0",
... | Update mr state by examing shard states.
Args:
state: current mapreduce state as MapreduceState.
shard_states: an iterator over shard states.
control: model.MapreduceControl entity. | [
"Update",
"mr",
"state",
"by",
"examing",
"shard",
"states",
"."
] | 2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6 | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/handlers.py#L1127-L1210 | train | Update the state by examing shard states. | 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/handlers.py | ControllerCallbackHandler._finalize_outputs | def _finalize_outputs(cls, mapreduce_spec, mapreduce_state):
"""Finalize outputs.
Args:
mapreduce_spec: an instance of MapreduceSpec.
mapreduce_state: an instance of MapreduceState.
"""
# Only finalize the output writers if the job is successful.
if (mapreduce_spec.mapper.output_writer_... | python | def _finalize_outputs(cls, mapreduce_spec, mapreduce_state):
"""Finalize outputs.
Args:
mapreduce_spec: an instance of MapreduceSpec.
mapreduce_state: an instance of MapreduceState.
"""
# Only finalize the output writers if the job is successful.
if (mapreduce_spec.mapper.output_writer_... | [
"def",
"_finalize_outputs",
"(",
"cls",
",",
"mapreduce_spec",
",",
"mapreduce_state",
")",
":",
"# Only finalize the output writers if the job is successful.",
"if",
"(",
"mapreduce_spec",
".",
"mapper",
".",
"output_writer_class",
"(",
")",
"and",
"mapreduce_state",
"."... | Finalize outputs.
Args:
mapreduce_spec: an instance of MapreduceSpec.
mapreduce_state: an instance of MapreduceState. | [
"Finalize",
"outputs",
"."
] | 2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6 | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/handlers.py#L1221-L1231 | train | Finalize outputs. | 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/handlers.py | ControllerCallbackHandler._finalize_job | def _finalize_job(cls, mapreduce_spec, mapreduce_state):
"""Finalize job execution.
Invokes done callback and save mapreduce state in a transaction,
and schedule necessary clean ups. This method is idempotent.
Args:
mapreduce_spec: an instance of MapreduceSpec
mapreduce_state: an instance ... | python | def _finalize_job(cls, mapreduce_spec, mapreduce_state):
"""Finalize job execution.
Invokes done callback and save mapreduce state in a transaction,
and schedule necessary clean ups. This method is idempotent.
Args:
mapreduce_spec: an instance of MapreduceSpec
mapreduce_state: an instance ... | [
"def",
"_finalize_job",
"(",
"cls",
",",
"mapreduce_spec",
",",
"mapreduce_state",
")",
":",
"config",
"=",
"util",
".",
"create_datastore_write_config",
"(",
"mapreduce_spec",
")",
"queue_name",
"=",
"util",
".",
"get_queue_name",
"(",
"mapreduce_spec",
".",
"par... | Finalize job execution.
Invokes done callback and save mapreduce state in a transaction,
and schedule necessary clean ups. This method is idempotent.
Args:
mapreduce_spec: an instance of MapreduceSpec
mapreduce_state: an instance of MapreduceState | [
"Finalize",
"job",
"execution",
"."
] | 2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6 | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/handlers.py#L1234-L1279 | train | Finalize a job execution. | 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/handlers.py | ControllerCallbackHandler.reschedule | def reschedule(cls,
mapreduce_state,
mapreduce_spec,
serial_id,
queue_name=None):
"""Schedule new update status callback task.
Args:
mapreduce_state: mapreduce state as model.MapreduceState
mapreduce_spec: mapreduce specification a... | python | def reschedule(cls,
mapreduce_state,
mapreduce_spec,
serial_id,
queue_name=None):
"""Schedule new update status callback task.
Args:
mapreduce_state: mapreduce state as model.MapreduceState
mapreduce_spec: mapreduce specification a... | [
"def",
"reschedule",
"(",
"cls",
",",
"mapreduce_state",
",",
"mapreduce_spec",
",",
"serial_id",
",",
"queue_name",
"=",
"None",
")",
":",
"task_name",
"=",
"ControllerCallbackHandler",
".",
"get_task_name",
"(",
"mapreduce_spec",
",",
"serial_id",
")",
"task_par... | Schedule new update status callback task.
Args:
mapreduce_state: mapreduce state as model.MapreduceState
mapreduce_spec: mapreduce specification as MapreduceSpec.
serial_id: id of the invocation as int.
queue_name: The queue to schedule this task on. Will use the current
queue of ex... | [
"Schedule",
"new",
"update",
"status",
"callback",
"task",
"."
] | 2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6 | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/handlers.py#L1319-L1357 | train | Reschedule a new update status callback 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/handlers.py | KickOffJobHandler.handle | def handle(self):
"""Handles kick off request."""
# Get and verify mr state.
mr_id = self.request.get("mapreduce_id")
# Log the mr_id since this is started in an unnamed task
logging.info("Processing kickoff for job %s", mr_id)
state = model.MapreduceState.get_by_job_id(mr_id)
if not self._c... | python | def handle(self):
"""Handles kick off request."""
# Get and verify mr state.
mr_id = self.request.get("mapreduce_id")
# Log the mr_id since this is started in an unnamed task
logging.info("Processing kickoff for job %s", mr_id)
state = model.MapreduceState.get_by_job_id(mr_id)
if not self._c... | [
"def",
"handle",
"(",
"self",
")",
":",
"# Get and verify mr state.",
"mr_id",
"=",
"self",
".",
"request",
".",
"get",
"(",
"\"mapreduce_id\"",
")",
"# Log the mr_id since this is started in an unnamed task",
"logging",
".",
"info",
"(",
"\"Processing kickoff for job %s\... | Handles kick off request. | [
"Handles",
"kick",
"off",
"request",
"."
] | 2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6 | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/handlers.py#L1376-L1415 | train | Handles kick off 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/handlers.py | KickOffJobHandler._drop_gracefully | def _drop_gracefully(self):
"""See parent."""
mr_id = self.request.get("mapreduce_id")
logging.error("Failed to kick off job %s", mr_id)
state = model.MapreduceState.get_by_job_id(mr_id)
if not self._check_mr_state(state, mr_id):
return
# Issue abort command just in case there are runnin... | python | def _drop_gracefully(self):
"""See parent."""
mr_id = self.request.get("mapreduce_id")
logging.error("Failed to kick off job %s", mr_id)
state = model.MapreduceState.get_by_job_id(mr_id)
if not self._check_mr_state(state, mr_id):
return
# Issue abort command just in case there are runnin... | [
"def",
"_drop_gracefully",
"(",
"self",
")",
":",
"mr_id",
"=",
"self",
".",
"request",
".",
"get",
"(",
"\"mapreduce_id\"",
")",
"logging",
".",
"error",
"(",
"\"Failed to kick off job %s\"",
",",
"mr_id",
")",
"state",
"=",
"model",
".",
"MapreduceState",
... | See parent. | [
"See",
"parent",
"."
] | 2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6 | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/handlers.py#L1417-L1433 | train | Drop the current job and abort all tasks. | 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/handlers.py | KickOffJobHandler._get_input_readers | def _get_input_readers(self, state):
"""Get input readers.
Args:
state: a MapreduceState model.
Returns:
A tuple: (a list of input readers, a model._HugeTaskPayload entity).
The payload entity contains the json serialized input readers.
(None, None) when input reader inplitting returne... | python | def _get_input_readers(self, state):
"""Get input readers.
Args:
state: a MapreduceState model.
Returns:
A tuple: (a list of input readers, a model._HugeTaskPayload entity).
The payload entity contains the json serialized input readers.
(None, None) when input reader inplitting returne... | [
"def",
"_get_input_readers",
"(",
"self",
",",
"state",
")",
":",
"serialized_input_readers_key",
"=",
"(",
"self",
".",
"_SERIALIZED_INPUT_READERS_KEY",
"%",
"state",
".",
"key",
"(",
")",
".",
"id_or_name",
"(",
")",
")",
"serialized_input_readers",
"=",
"mode... | Get input readers.
Args:
state: a MapreduceState model.
Returns:
A tuple: (a list of input readers, a model._HugeTaskPayload entity).
The payload entity contains the json serialized input readers.
(None, None) when input reader inplitting returned no data to process. | [
"Get",
"input",
"readers",
"."
] | 2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6 | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/handlers.py#L1435-L1480 | train | Get input readers. | 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/handlers.py | KickOffJobHandler._save_states | def _save_states(self, state, serialized_readers_entity):
"""Run transaction to save state.
Args:
state: a model.MapreduceState entity.
serialized_readers_entity: a model._HugeTaskPayload entity containing
json serialized input readers.
Returns:
False if a fatal error is encounte... | python | def _save_states(self, state, serialized_readers_entity):
"""Run transaction to save state.
Args:
state: a model.MapreduceState entity.
serialized_readers_entity: a model._HugeTaskPayload entity containing
json serialized input readers.
Returns:
False if a fatal error is encounte... | [
"def",
"_save_states",
"(",
"self",
",",
"state",
",",
"serialized_readers_entity",
")",
":",
"mr_id",
"=",
"state",
".",
"key",
"(",
")",
".",
"id_or_name",
"(",
")",
"fresh_state",
"=",
"model",
".",
"MapreduceState",
".",
"get_by_job_id",
"(",
"mr_id",
... | Run transaction to save state.
Args:
state: a model.MapreduceState entity.
serialized_readers_entity: a model._HugeTaskPayload entity containing
json serialized input readers.
Returns:
False if a fatal error is encountered and this task should be dropped
immediately. True if tran... | [
"Run",
"transaction",
"to",
"save",
"state",
"."
] | 2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6 | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/handlers.py#L1489-L1513 | train | Run transaction to save 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/handlers.py | KickOffJobHandler._schedule_shards | def _schedule_shards(cls,
spec,
readers,
queue_name,
base_path,
mr_state):
"""Prepares shard states and schedules their execution.
Even though this method does not schedule shard task and save sha... | python | def _schedule_shards(cls,
spec,
readers,
queue_name,
base_path,
mr_state):
"""Prepares shard states and schedules their execution.
Even though this method does not schedule shard task and save sha... | [
"def",
"_schedule_shards",
"(",
"cls",
",",
"spec",
",",
"readers",
",",
"queue_name",
",",
"base_path",
",",
"mr_state",
")",
":",
"# Create shard states.",
"shard_states",
"=",
"[",
"]",
"for",
"shard_number",
",",
"input_reader",
"in",
"enumerate",
"(",
"re... | Prepares shard states and schedules their execution.
Even though this method does not schedule shard task and save shard state
transactionally, it's safe for taskqueue to retry this logic because
the initial shard_state for each shard is the same from any retry.
This is an important yet reasonable assu... | [
"Prepares",
"shard",
"states",
"and",
"schedules",
"their",
"execution",
"."
] | 2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6 | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/handlers.py#L1516-L1579 | train | Prepares shard states and schedules their execution. | 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/handlers.py | KickOffJobHandler._check_mr_state | def _check_mr_state(cls, state, mr_id):
"""Check MapreduceState.
Args:
state: an MapreduceState instance.
mr_id: mapreduce id.
Returns:
True if state is valid. False if not and this task should be dropped.
"""
if state is None:
logging.warning(
"Mapreduce State fo... | python | def _check_mr_state(cls, state, mr_id):
"""Check MapreduceState.
Args:
state: an MapreduceState instance.
mr_id: mapreduce id.
Returns:
True if state is valid. False if not and this task should be dropped.
"""
if state is None:
logging.warning(
"Mapreduce State fo... | [
"def",
"_check_mr_state",
"(",
"cls",
",",
"state",
",",
"mr_id",
")",
":",
"if",
"state",
"is",
"None",
":",
"logging",
".",
"warning",
"(",
"\"Mapreduce State for job %s is missing. Dropping Task.\"",
",",
"mr_id",
")",
"return",
"False",
"if",
"not",
"state",... | Check MapreduceState.
Args:
state: an MapreduceState instance.
mr_id: mapreduce id.
Returns:
True if state is valid. False if not and this task should be dropped. | [
"Check",
"MapreduceState",
"."
] | 2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6 | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/handlers.py#L1582-L1602 | train | Checks if the given MapreduceState instance is valid. | 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/handlers.py | StartJobHandler.handle | def handle(self):
"""Handles start request."""
# Mapper spec as form arguments.
mapreduce_name = self._get_required_param("name")
mapper_input_reader_spec = self._get_required_param("mapper_input_reader")
mapper_handler_spec = self._get_required_param("mapper_handler")
mapper_output_writer_spec ... | python | def handle(self):
"""Handles start request."""
# Mapper spec as form arguments.
mapreduce_name = self._get_required_param("name")
mapper_input_reader_spec = self._get_required_param("mapper_input_reader")
mapper_handler_spec = self._get_required_param("mapper_handler")
mapper_output_writer_spec ... | [
"def",
"handle",
"(",
"self",
")",
":",
"# Mapper spec as form arguments.",
"mapreduce_name",
"=",
"self",
".",
"_get_required_param",
"(",
"\"name\"",
")",
"mapper_input_reader_spec",
"=",
"self",
".",
"_get_required_param",
"(",
"\"mapper_input_reader\"",
")",
"mapper... | Handles start request. | [
"Handles",
"start",
"request",
"."
] | 2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6 | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/handlers.py#L1612-L1648 | train | Handles start 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/handlers.py | StartJobHandler._get_params | def _get_params(self, validator_parameter, name_prefix):
"""Retrieves additional user-supplied params for the job and validates them.
Args:
validator_parameter: name of the request parameter which supplies
validator for this parameter set.
name_prefix: common prefix for all parameter names ... | python | def _get_params(self, validator_parameter, name_prefix):
"""Retrieves additional user-supplied params for the job and validates them.
Args:
validator_parameter: name of the request parameter which supplies
validator for this parameter set.
name_prefix: common prefix for all parameter names ... | [
"def",
"_get_params",
"(",
"self",
",",
"validator_parameter",
",",
"name_prefix",
")",
":",
"params_validator",
"=",
"self",
".",
"request",
".",
"get",
"(",
"validator_parameter",
")",
"user_params",
"=",
"{",
"}",
"for",
"key",
"in",
"self",
".",
"request... | Retrieves additional user-supplied params for the job and validates them.
Args:
validator_parameter: name of the request parameter which supplies
validator for this parameter set.
name_prefix: common prefix for all parameter names in the request.
Raises:
Any exception raised by the '... | [
"Retrieves",
"additional",
"user",
"-",
"supplied",
"params",
"for",
"the",
"job",
"and",
"validates",
"them",
"."
] | 2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6 | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/handlers.py#L1650-L1681 | train | Retrieves additional user - supplied params for the job and validates them. | 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/handlers.py | StartJobHandler._get_required_param | def _get_required_param(self, param_name):
"""Get a required request parameter.
Args:
param_name: name of request parameter to fetch.
Returns:
parameter value
Raises:
errors.NotEnoughArgumentsError: if parameter is not specified.
"""
value = self.request.get(param_name)
... | python | def _get_required_param(self, param_name):
"""Get a required request parameter.
Args:
param_name: name of request parameter to fetch.
Returns:
parameter value
Raises:
errors.NotEnoughArgumentsError: if parameter is not specified.
"""
value = self.request.get(param_name)
... | [
"def",
"_get_required_param",
"(",
"self",
",",
"param_name",
")",
":",
"value",
"=",
"self",
".",
"request",
".",
"get",
"(",
"param_name",
")",
"if",
"not",
"value",
":",
"raise",
"errors",
".",
"NotEnoughArgumentsError",
"(",
"param_name",
"+",
"\" not sp... | Get a required request parameter.
Args:
param_name: name of request parameter to fetch.
Returns:
parameter value
Raises:
errors.NotEnoughArgumentsError: if parameter is not specified. | [
"Get",
"a",
"required",
"request",
"parameter",
"."
] | 2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6 | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/handlers.py#L1683-L1698 | train | Get a required request parameter. | 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/handlers.py | StartJobHandler._start_map | def _start_map(cls,
name,
mapper_spec,
mapreduce_params,
queue_name,
eta=None,
countdown=None,
hooks_class_name=None,
_app=None,
in_xg_transaction=False):
# pylint... | python | def _start_map(cls,
name,
mapper_spec,
mapreduce_params,
queue_name,
eta=None,
countdown=None,
hooks_class_name=None,
_app=None,
in_xg_transaction=False):
# pylint... | [
"def",
"_start_map",
"(",
"cls",
",",
"name",
",",
"mapper_spec",
",",
"mapreduce_params",
",",
"queue_name",
",",
"eta",
"=",
"None",
",",
"countdown",
"=",
"None",
",",
"hooks_class_name",
"=",
"None",
",",
"_app",
"=",
"None",
",",
"in_xg_transaction",
... | See control.start_map.
Requirements for this method:
1. The request that invokes this method can either be regular or
from taskqueue. So taskqueue specific headers can not be used.
2. Each invocation transactionally starts an isolated mapreduce job with
a unique id. MapreduceState should be i... | [
"See",
"control",
".",
"start_map",
"."
] | 2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6 | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/handlers.py#L1701-L1763 | 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/handlers.py | StartJobHandler._create_and_save_state | def _create_and_save_state(cls, mapreduce_spec, _app):
"""Save mapreduce state to datastore.
Save state to datastore so that UI can see it immediately.
Args:
mapreduce_spec: model.MapreduceSpec,
_app: app id if specified. None otherwise.
Returns:
The saved Mapreduce state.
"""
... | python | def _create_and_save_state(cls, mapreduce_spec, _app):
"""Save mapreduce state to datastore.
Save state to datastore so that UI can see it immediately.
Args:
mapreduce_spec: model.MapreduceSpec,
_app: app id if specified. None otherwise.
Returns:
The saved Mapreduce state.
"""
... | [
"def",
"_create_and_save_state",
"(",
"cls",
",",
"mapreduce_spec",
",",
"_app",
")",
":",
"state",
"=",
"model",
".",
"MapreduceState",
".",
"create_new",
"(",
"mapreduce_spec",
".",
"mapreduce_id",
")",
"state",
".",
"mapreduce_spec",
"=",
"mapreduce_spec",
"s... | Save mapreduce state to datastore.
Save state to datastore so that UI can see it immediately.
Args:
mapreduce_spec: model.MapreduceSpec,
_app: app id if specified. None otherwise.
Returns:
The saved Mapreduce state. | [
"Save",
"mapreduce",
"state",
"to",
"datastore",
"."
] | 2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6 | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/handlers.py#L1766-L1786 | train | Create and save Mapreduce 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/handlers.py | StartJobHandler._add_kickoff_task | def _add_kickoff_task(cls,
base_path,
mapreduce_spec,
eta,
countdown,
queue_name):
"""Enqueues a new kickoff task."""
params = {"mapreduce_id": mapreduce_spec.mapreduce_id}
# Task is not n... | python | def _add_kickoff_task(cls,
base_path,
mapreduce_spec,
eta,
countdown,
queue_name):
"""Enqueues a new kickoff task."""
params = {"mapreduce_id": mapreduce_spec.mapreduce_id}
# Task is not n... | [
"def",
"_add_kickoff_task",
"(",
"cls",
",",
"base_path",
",",
"mapreduce_spec",
",",
"eta",
",",
"countdown",
",",
"queue_name",
")",
":",
"params",
"=",
"{",
"\"mapreduce_id\"",
":",
"mapreduce_spec",
".",
"mapreduce_id",
"}",
"# Task is not named so that it can b... | Enqueues a new kickoff task. | [
"Enqueues",
"a",
"new",
"kickoff",
"task",
"."
] | 2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6 | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/handlers.py#L1789-L1811 | train | Enqueues a new kickoff 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/handlers.py | FinalizeJobHandler.schedule | def schedule(cls, mapreduce_spec):
"""Schedule finalize task.
Args:
mapreduce_spec: mapreduce specification as MapreduceSpec.
"""
task_name = mapreduce_spec.mapreduce_id + "-finalize"
finalize_task = taskqueue.Task(
name=task_name,
url=(mapreduce_spec.params["base_path"] + "/f... | python | def schedule(cls, mapreduce_spec):
"""Schedule finalize task.
Args:
mapreduce_spec: mapreduce specification as MapreduceSpec.
"""
task_name = mapreduce_spec.mapreduce_id + "-finalize"
finalize_task = taskqueue.Task(
name=task_name,
url=(mapreduce_spec.params["base_path"] + "/f... | [
"def",
"schedule",
"(",
"cls",
",",
"mapreduce_spec",
")",
":",
"task_name",
"=",
"mapreduce_spec",
".",
"mapreduce_id",
"+",
"\"-finalize\"",
"finalize_task",
"=",
"taskqueue",
".",
"Task",
"(",
"name",
"=",
"task_name",
",",
"url",
"=",
"(",
"mapreduce_spec"... | Schedule finalize task.
Args:
mapreduce_spec: mapreduce specification as MapreduceSpec. | [
"Schedule",
"finalize",
"task",
"."
] | 2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6 | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/handlers.py#L1832-L1855 | train | Schedule the finalization of the mapreduce 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/input_readers.py | _get_params | def _get_params(mapper_spec, allowed_keys=None, allow_old=True):
"""Obtain input reader parameters.
Utility function for input readers implementation. Fetches parameters
from mapreduce specification giving appropriate usage warnings.
Args:
mapper_spec: The MapperSpec for the job
allowed_keys: set of a... | python | def _get_params(mapper_spec, allowed_keys=None, allow_old=True):
"""Obtain input reader parameters.
Utility function for input readers implementation. Fetches parameters
from mapreduce specification giving appropriate usage warnings.
Args:
mapper_spec: The MapperSpec for the job
allowed_keys: set of a... | [
"def",
"_get_params",
"(",
"mapper_spec",
",",
"allowed_keys",
"=",
"None",
",",
"allow_old",
"=",
"True",
")",
":",
"if",
"\"input_reader\"",
"not",
"in",
"mapper_spec",
".",
"params",
":",
"message",
"=",
"(",
"\"Input reader's parameters should be specified in \"... | Obtain input reader parameters.
Utility function for input readers implementation. Fetches parameters
from mapreduce specification giving appropriate usage warnings.
Args:
mapper_spec: The MapperSpec for the job
allowed_keys: set of all allowed keys in parameters as strings. If it is not
None, the... | [
"Obtain",
"input",
"reader",
"parameters",
"."
] | 2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6 | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/input_readers.py#L206-L244 | train | Utility function for input readers implementation. Fetches input reader parameters from mapreduce specification and returns them as a 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/input_readers.py | AbstractDatastoreInputReader._split_ns_by_scatter | def _split_ns_by_scatter(cls,
shard_count,
namespace,
raw_entity_kind,
filters,
app):
"""Split a namespace by scatter index into key_range.KeyRange.
TODO(user): Power this with... | python | def _split_ns_by_scatter(cls,
shard_count,
namespace,
raw_entity_kind,
filters,
app):
"""Split a namespace by scatter index into key_range.KeyRange.
TODO(user): Power this with... | [
"def",
"_split_ns_by_scatter",
"(",
"cls",
",",
"shard_count",
",",
"namespace",
",",
"raw_entity_kind",
",",
"filters",
",",
"app",
")",
":",
"if",
"shard_count",
"==",
"1",
":",
"# With one shard we don't need to calculate any split points at all.",
"return",
"[",
"... | Split a namespace by scatter index into key_range.KeyRange.
TODO(user): Power this with key_range.KeyRange.compute_split_points.
Args:
shard_count: number of shards.
namespace: namespace name to split. str.
raw_entity_kind: low level datastore API entity kind.
app: app id in str.
... | [
"Split",
"a",
"namespace",
"by",
"scatter",
"index",
"into",
"key_range",
".",
"KeyRange",
"."
] | 2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6 | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/input_readers.py#L418-L511 | train | Splits a namespace by scatter index. | 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/input_readers.py | AbstractDatastoreInputReader._choose_split_points | def _choose_split_points(cls, sorted_keys, shard_count):
"""Returns the best split points given a random set of datastore.Keys."""
assert len(sorted_keys) >= shard_count
index_stride = len(sorted_keys) / float(shard_count)
return [sorted_keys[int(round(index_stride * i))]
for i in range(1, s... | python | def _choose_split_points(cls, sorted_keys, shard_count):
"""Returns the best split points given a random set of datastore.Keys."""
assert len(sorted_keys) >= shard_count
index_stride = len(sorted_keys) / float(shard_count)
return [sorted_keys[int(round(index_stride * i))]
for i in range(1, s... | [
"def",
"_choose_split_points",
"(",
"cls",
",",
"sorted_keys",
",",
"shard_count",
")",
":",
"assert",
"len",
"(",
"sorted_keys",
")",
">=",
"shard_count",
"index_stride",
"=",
"len",
"(",
"sorted_keys",
")",
"/",
"float",
"(",
"shard_count",
")",
"return",
... | Returns the best split points given a random set of datastore.Keys. | [
"Returns",
"the",
"best",
"split",
"points",
"given",
"a",
"random",
"set",
"of",
"datastore",
".",
"Keys",
"."
] | 2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6 | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/input_readers.py#L514-L519 | train | Returns the best split points given a random set of datastore. 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/input_readers.py | AbstractDatastoreInputReader.validate | def validate(cls, mapper_spec):
"""Inherit docs."""
params = _get_params(mapper_spec)
if cls.ENTITY_KIND_PARAM not in params:
raise BadReaderParamsError("Missing input reader parameter 'entity_kind'")
if cls.BATCH_SIZE_PARAM in params:
try:
batch_size = int(params[cls.BATCH_SIZE_PARA... | python | def validate(cls, mapper_spec):
"""Inherit docs."""
params = _get_params(mapper_spec)
if cls.ENTITY_KIND_PARAM not in params:
raise BadReaderParamsError("Missing input reader parameter 'entity_kind'")
if cls.BATCH_SIZE_PARAM in params:
try:
batch_size = int(params[cls.BATCH_SIZE_PARA... | [
"def",
"validate",
"(",
"cls",
",",
"mapper_spec",
")",
":",
"params",
"=",
"_get_params",
"(",
"mapper_spec",
")",
"if",
"cls",
".",
"ENTITY_KIND_PARAM",
"not",
"in",
"params",
":",
"raise",
"BadReaderParamsError",
"(",
"\"Missing input reader parameter 'entity_kin... | Inherit docs. | [
"Inherit",
"docs",
"."
] | 2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6 | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/input_readers.py#L522-L567 | 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/input_readers.py | RawDatastoreInputReader.validate | def validate(cls, mapper_spec):
"""Inherit docs."""
super(RawDatastoreInputReader, cls).validate(mapper_spec)
params = _get_params(mapper_spec)
entity_kind = params[cls.ENTITY_KIND_PARAM]
if "." in entity_kind:
logging.warning(
". detected in entity kind %s specified for reader %s."
... | python | def validate(cls, mapper_spec):
"""Inherit docs."""
super(RawDatastoreInputReader, cls).validate(mapper_spec)
params = _get_params(mapper_spec)
entity_kind = params[cls.ENTITY_KIND_PARAM]
if "." in entity_kind:
logging.warning(
". detected in entity kind %s specified for reader %s."
... | [
"def",
"validate",
"(",
"cls",
",",
"mapper_spec",
")",
":",
"super",
"(",
"RawDatastoreInputReader",
",",
"cls",
")",
".",
"validate",
"(",
"mapper_spec",
")",
"params",
"=",
"_get_params",
"(",
"mapper_spec",
")",
"entity_kind",
"=",
"params",
"[",
"cls",
... | Inherit docs. | [
"Inherit",
"docs",
"."
] | 2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6 | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/input_readers.py#L589-L604 | 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/input_readers.py | DatastoreInputReader.validate | def validate(cls, mapper_spec):
"""Inherit docs."""
super(DatastoreInputReader, cls).validate(mapper_spec)
params = _get_params(mapper_spec)
entity_kind = params[cls.ENTITY_KIND_PARAM]
# Fail fast if Model cannot be located.
try:
model_class = util.for_name(entity_kind)
except ImportEr... | python | def validate(cls, mapper_spec):
"""Inherit docs."""
super(DatastoreInputReader, cls).validate(mapper_spec)
params = _get_params(mapper_spec)
entity_kind = params[cls.ENTITY_KIND_PARAM]
# Fail fast if Model cannot be located.
try:
model_class = util.for_name(entity_kind)
except ImportEr... | [
"def",
"validate",
"(",
"cls",
",",
"mapper_spec",
")",
":",
"super",
"(",
"DatastoreInputReader",
",",
"cls",
")",
".",
"validate",
"(",
"mapper_spec",
")",
"params",
"=",
"_get_params",
"(",
"mapper_spec",
")",
"entity_kind",
"=",
"params",
"[",
"cls",
"... | Inherit docs. | [
"Inherit",
"docs",
"."
] | 2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6 | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/input_readers.py#L627-L643 | 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/input_readers.py | DatastoreInputReader._validate_filters_ndb | def _validate_filters_ndb(cls, filters, model_class):
"""Validate ndb.Model filters."""
if not filters:
return
properties = model_class._properties
for idx, f in enumerate(filters):
prop, ineq, val = f
if prop not in properties:
raise errors.BadReaderParamsError(
... | python | def _validate_filters_ndb(cls, filters, model_class):
"""Validate ndb.Model filters."""
if not filters:
return
properties = model_class._properties
for idx, f in enumerate(filters):
prop, ineq, val = f
if prop not in properties:
raise errors.BadReaderParamsError(
... | [
"def",
"_validate_filters_ndb",
"(",
"cls",
",",
"filters",
",",
"model_class",
")",
":",
"if",
"not",
"filters",
":",
"return",
"properties",
"=",
"model_class",
".",
"_properties",
"for",
"idx",
",",
"f",
"in",
"enumerate",
"(",
"filters",
")",
":",
"pro... | Validate ndb.Model filters. | [
"Validate",
"ndb",
".",
"Model",
"filters",
"."
] | 2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6 | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/input_readers.py#L682-L713 | train | Validate the filters for the entity type. | 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/input_readers.py | DatastoreInputReader.split_input | def split_input(cls, mapper_spec):
"""Inherit docs."""
shard_count = mapper_spec.shard_count
query_spec = cls._get_query_spec(mapper_spec)
if not property_range.should_shard_by_property_range(query_spec.filters):
return super(DatastoreInputReader, cls).split_input(mapper_spec)
# Artificially... | python | def split_input(cls, mapper_spec):
"""Inherit docs."""
shard_count = mapper_spec.shard_count
query_spec = cls._get_query_spec(mapper_spec)
if not property_range.should_shard_by_property_range(query_spec.filters):
return super(DatastoreInputReader, cls).split_input(mapper_spec)
# Artificially... | [
"def",
"split_input",
"(",
"cls",
",",
"mapper_spec",
")",
":",
"shard_count",
"=",
"mapper_spec",
".",
"shard_count",
"query_spec",
"=",
"cls",
".",
"_get_query_spec",
"(",
"mapper_spec",
")",
"if",
"not",
"property_range",
".",
"should_shard_by_property_range",
... | Inherit docs. | [
"Inherit",
"docs",
"."
] | 2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6 | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/input_readers.py#L716-L785 | 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/input_readers.py | _OldAbstractDatastoreInputReader._iter_key_ranges | def _iter_key_ranges(self):
"""Iterates over self._key_ranges, delegating to self._iter_key_range()."""
while True:
if self._current_key_range is None:
if self._key_ranges:
self._current_key_range = self._key_ranges.pop()
# The most recently popped key_range may be None, so con... | python | def _iter_key_ranges(self):
"""Iterates over self._key_ranges, delegating to self._iter_key_range()."""
while True:
if self._current_key_range is None:
if self._key_ranges:
self._current_key_range = self._key_ranges.pop()
# The most recently popped key_range may be None, so con... | [
"def",
"_iter_key_ranges",
"(",
"self",
")",
":",
"while",
"True",
":",
"if",
"self",
".",
"_current_key_range",
"is",
"None",
":",
"if",
"self",
".",
"_key_ranges",
":",
"self",
".",
"_current_key_range",
"=",
"self",
".",
"_key_ranges",
".",
"pop",
"(",
... | Iterates over self._key_ranges, delegating to self._iter_key_range(). | [
"Iterates",
"over",
"self",
".",
"_key_ranges",
"delegating",
"to",
"self",
".",
"_iter_key_range",
"()",
"."
] | 2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6 | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/input_readers.py#L902-L920 | train | Iterates over self. _key_ranges and yields KeyRange objects. | 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/input_readers.py | _OldAbstractDatastoreInputReader._iter_ns_range | def _iter_ns_range(self):
"""Iterates over self._ns_range, delegating to self._iter_key_range()."""
while True:
if self._current_key_range is None:
query = self._ns_range.make_datastore_query()
namespace_result = query.Get(1)
if not namespace_result:
break
namesp... | python | def _iter_ns_range(self):
"""Iterates over self._ns_range, delegating to self._iter_key_range()."""
while True:
if self._current_key_range is None:
query = self._ns_range.make_datastore_query()
namespace_result = query.Get(1)
if not namespace_result:
break
namesp... | [
"def",
"_iter_ns_range",
"(",
"self",
")",
":",
"while",
"True",
":",
"if",
"self",
".",
"_current_key_range",
"is",
"None",
":",
"query",
"=",
"self",
".",
"_ns_range",
".",
"make_datastore_query",
"(",
")",
"namespace_result",
"=",
"query",
".",
"Get",
"... | Iterates over self._ns_range, delegating to self._iter_key_range(). | [
"Iterates",
"over",
"self",
".",
"_ns_range",
"delegating",
"to",
"self",
".",
"_iter_key_range",
"()",
"."
] | 2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6 | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/input_readers.py#L922-L948 | train | Iterates over self. _ns_range and yields the objects in self. _current_key_range. | 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/input_readers.py | _OldAbstractDatastoreInputReader._split_input_from_namespace | def _split_input_from_namespace(cls, app, namespace, entity_kind,
shard_count):
"""Helper for _split_input_from_params.
If there are not enough Entities to make all of the given shards, the
returned list of KeyRanges will include Nones. The returned list will
contain K... | python | def _split_input_from_namespace(cls, app, namespace, entity_kind,
shard_count):
"""Helper for _split_input_from_params.
If there are not enough Entities to make all of the given shards, the
returned list of KeyRanges will include Nones. The returned list will
contain K... | [
"def",
"_split_input_from_namespace",
"(",
"cls",
",",
"app",
",",
"namespace",
",",
"entity_kind",
",",
"shard_count",
")",
":",
"raw_entity_kind",
"=",
"cls",
".",
"_get_raw_entity_kind",
"(",
"entity_kind",
")",
"if",
"shard_count",
"==",
"1",
":",
"# With on... | Helper for _split_input_from_params.
If there are not enough Entities to make all of the given shards, the
returned list of KeyRanges will include Nones. The returned list will
contain KeyRanges ordered lexographically with any Nones appearing at the
end.
Args:
app: the app.
namespace:... | [
"Helper",
"for",
"_split_input_from_params",
"."
] | 2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6 | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/input_readers.py#L982-L1060 | train | Helper method for _split_input_from_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/input_readers.py | _OldAbstractDatastoreInputReader._split_input_from_params | def _split_input_from_params(cls, app, namespaces, entity_kind_name,
params, shard_count):
"""Return input reader objects. Helper for split_input."""
# pylint: disable=redefined-outer-name
key_ranges = [] # KeyRanges for all namespaces
for namespace in namespaces:
k... | python | def _split_input_from_params(cls, app, namespaces, entity_kind_name,
params, shard_count):
"""Return input reader objects. Helper for split_input."""
# pylint: disable=redefined-outer-name
key_ranges = [] # KeyRanges for all namespaces
for namespace in namespaces:
k... | [
"def",
"_split_input_from_params",
"(",
"cls",
",",
"app",
",",
"namespaces",
",",
"entity_kind_name",
",",
"params",
",",
"shard_count",
")",
":",
"# pylint: disable=redefined-outer-name",
"key_ranges",
"=",
"[",
"]",
"# KeyRanges for all namespaces",
"for",
"namespace... | Return input reader objects. Helper for split_input. | [
"Return",
"input",
"reader",
"objects",
".",
"Helper",
"for",
"split_input",
"."
] | 2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6 | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/input_readers.py#L1063-L1087 | train | Helper for split_input. | 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/input_readers.py | _OldAbstractDatastoreInputReader.validate | def validate(cls, mapper_spec):
"""Validates mapper spec and all mapper parameters.
Args:
mapper_spec: The MapperSpec for this InputReader.
Raises:
BadReaderParamsError: required parameters are missing or invalid.
"""
if mapper_spec.input_reader_class() != cls:
raise BadReaderPar... | python | def validate(cls, mapper_spec):
"""Validates mapper spec and all mapper parameters.
Args:
mapper_spec: The MapperSpec for this InputReader.
Raises:
BadReaderParamsError: required parameters are missing or invalid.
"""
if mapper_spec.input_reader_class() != cls:
raise BadReaderPar... | [
"def",
"validate",
"(",
"cls",
",",
"mapper_spec",
")",
":",
"if",
"mapper_spec",
".",
"input_reader_class",
"(",
")",
"!=",
"cls",
":",
"raise",
"BadReaderParamsError",
"(",
"\"Input reader class mismatch\"",
")",
"params",
"=",
"_get_params",
"(",
"mapper_spec",... | Validates mapper spec and all mapper parameters.
Args:
mapper_spec: The MapperSpec for this InputReader.
Raises:
BadReaderParamsError: required parameters are missing or invalid. | [
"Validates",
"mapper",
"spec",
"and",
"all",
"mapper",
"parameters",
"."
] | 2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6 | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/input_readers.py#L1090-L1131 | train | Validates the mapper spec and all required 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/input_readers.py | _OldAbstractDatastoreInputReader.split_input | def split_input(cls, mapper_spec):
"""Splits query into shards without fetching query results.
Tries as best as it can to split the whole query result set into equal
shards. Due to difficulty of making the perfect split, resulting shards'
sizes might differ significantly from each other.
Args:
... | python | def split_input(cls, mapper_spec):
"""Splits query into shards without fetching query results.
Tries as best as it can to split the whole query result set into equal
shards. Due to difficulty of making the perfect split, resulting shards'
sizes might differ significantly from each other.
Args:
... | [
"def",
"split_input",
"(",
"cls",
",",
"mapper_spec",
")",
":",
"params",
"=",
"_get_params",
"(",
"mapper_spec",
")",
"entity_kind_name",
"=",
"params",
"[",
"cls",
".",
"ENTITY_KIND_PARAM",
"]",
"batch_size",
"=",
"int",
"(",
"params",
".",
"get",
"(",
"... | Splits query into shards without fetching query results.
Tries as best as it can to split the whole query result set into equal
shards. Due to difficulty of making the perfect split, resulting shards'
sizes might differ significantly from each other.
Args:
mapper_spec: MapperSpec with params con... | [
"Splits",
"query",
"into",
"shards",
"without",
"fetching",
"query",
"results",
"."
] | 2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6 | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/input_readers.py#L1134-L1208 | train | Splits the input into shards without fetching query results. | 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/input_readers.py | _OldAbstractDatastoreInputReader.to_json | def to_json(self):
"""Serializes all the data in this query range into json form.
Returns:
all the data in json-compatible map.
"""
if self._key_ranges is None:
key_ranges_json = None
else:
key_ranges_json = []
for k in self._key_ranges:
if k:
key_ranges_js... | python | def to_json(self):
"""Serializes all the data in this query range into json form.
Returns:
all the data in json-compatible map.
"""
if self._key_ranges is None:
key_ranges_json = None
else:
key_ranges_json = []
for k in self._key_ranges:
if k:
key_ranges_js... | [
"def",
"to_json",
"(",
"self",
")",
":",
"if",
"self",
".",
"_key_ranges",
"is",
"None",
":",
"key_ranges_json",
"=",
"None",
"else",
":",
"key_ranges_json",
"=",
"[",
"]",
"for",
"k",
"in",
"self",
".",
"_key_ranges",
":",
"if",
"k",
":",
"key_ranges_... | Serializes all the data in this query range into json form.
Returns:
all the data in json-compatible map. | [
"Serializes",
"all",
"the",
"data",
"in",
"this",
"query",
"range",
"into",
"json",
"form",
"."
] | 2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6 | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/input_readers.py#L1210-L1242 | train | Serializes all the data in this query range into json - compatible 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/input_readers.py | _OldAbstractDatastoreInputReader.from_json | def from_json(cls, json):
"""Create new DatastoreInputReader from the json, encoded by to_json.
Args:
json: json map representation of DatastoreInputReader.
Returns:
an instance of DatastoreInputReader with all data deserialized from json.
"""
if json[cls.KEY_RANGE_PARAM] is None:
... | python | def from_json(cls, json):
"""Create new DatastoreInputReader from the json, encoded by to_json.
Args:
json: json map representation of DatastoreInputReader.
Returns:
an instance of DatastoreInputReader with all data deserialized from json.
"""
if json[cls.KEY_RANGE_PARAM] is None:
... | [
"def",
"from_json",
"(",
"cls",
",",
"json",
")",
":",
"if",
"json",
"[",
"cls",
".",
"KEY_RANGE_PARAM",
"]",
"is",
"None",
":",
"# pylint: disable=redefined-outer-name",
"key_ranges",
"=",
"None",
"else",
":",
"key_ranges",
"=",
"[",
"]",
"for",
"k",
"in"... | Create new DatastoreInputReader from the json, encoded by to_json.
Args:
json: json map representation of DatastoreInputReader.
Returns:
an instance of DatastoreInputReader with all data deserialized from json. | [
"Create",
"new",
"DatastoreInputReader",
"from",
"the",
"json",
"encoded",
"by",
"to_json",
"."
] | 2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6 | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/input_readers.py#L1245-L1283 | train | Create a new DatastoreInputReader from the json encoded by 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/input_readers.py | BlobstoreLineInputReader.next | def next(self):
"""Returns the next input from as an (offset, line) tuple."""
self._has_iterated = True
if self._read_before_start:
self._blob_reader.readline()
self._read_before_start = False
start_position = self._blob_reader.tell()
if start_position > self._end_position:
raise... | python | def next(self):
"""Returns the next input from as an (offset, line) tuple."""
self._has_iterated = True
if self._read_before_start:
self._blob_reader.readline()
self._read_before_start = False
start_position = self._blob_reader.tell()
if start_position > self._end_position:
raise... | [
"def",
"next",
"(",
"self",
")",
":",
"self",
".",
"_has_iterated",
"=",
"True",
"if",
"self",
".",
"_read_before_start",
":",
"self",
".",
"_blob_reader",
".",
"readline",
"(",
")",
"self",
".",
"_read_before_start",
"=",
"False",
"start_position",
"=",
"... | Returns the next input from as an (offset, line) tuple. | [
"Returns",
"the",
"next",
"input",
"from",
"as",
"an",
"(",
"offset",
"line",
")",
"tuple",
"."
] | 2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6 | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/input_readers.py#L1327-L1344 | train | Returns the next input from as an ( offset line ) tuple. | 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/input_readers.py | BlobstoreLineInputReader.to_json | def to_json(self):
"""Returns an json-compatible input shard spec for remaining inputs."""
new_pos = self._blob_reader.tell()
if self._has_iterated:
new_pos -= 1
return {self.BLOB_KEY_PARAM: self._blob_key,
self.INITIAL_POSITION_PARAM: new_pos,
self.END_POSITION_PARAM: self... | python | def to_json(self):
"""Returns an json-compatible input shard spec for remaining inputs."""
new_pos = self._blob_reader.tell()
if self._has_iterated:
new_pos -= 1
return {self.BLOB_KEY_PARAM: self._blob_key,
self.INITIAL_POSITION_PARAM: new_pos,
self.END_POSITION_PARAM: self... | [
"def",
"to_json",
"(",
"self",
")",
":",
"new_pos",
"=",
"self",
".",
"_blob_reader",
".",
"tell",
"(",
")",
"if",
"self",
".",
"_has_iterated",
":",
"new_pos",
"-=",
"1",
"return",
"{",
"self",
".",
"BLOB_KEY_PARAM",
":",
"self",
".",
"_blob_key",
","... | Returns an json-compatible input shard spec for remaining inputs. | [
"Returns",
"an",
"json",
"-",
"compatible",
"input",
"shard",
"spec",
"for",
"remaining",
"inputs",
"."
] | 2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6 | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/input_readers.py#L1346-L1353 | train | Returns an json - compatible input shard spec for remaining inputs. | 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/input_readers.py | BlobstoreLineInputReader.from_json | def from_json(cls, json):
"""Instantiates an instance of this InputReader for the given shard spec."""
return cls(json[cls.BLOB_KEY_PARAM],
json[cls.INITIAL_POSITION_PARAM],
json[cls.END_POSITION_PARAM]) | python | def from_json(cls, json):
"""Instantiates an instance of this InputReader for the given shard spec."""
return cls(json[cls.BLOB_KEY_PARAM],
json[cls.INITIAL_POSITION_PARAM],
json[cls.END_POSITION_PARAM]) | [
"def",
"from_json",
"(",
"cls",
",",
"json",
")",
":",
"return",
"cls",
"(",
"json",
"[",
"cls",
".",
"BLOB_KEY_PARAM",
"]",
",",
"json",
"[",
"cls",
".",
"INITIAL_POSITION_PARAM",
"]",
",",
"json",
"[",
"cls",
".",
"END_POSITION_PARAM",
"]",
")"
] | Instantiates an instance of this InputReader for the given shard spec. | [
"Instantiates",
"an",
"instance",
"of",
"this",
"InputReader",
"for",
"the",
"given",
"shard",
"spec",
"."
] | 2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6 | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/input_readers.py#L1361-L1365 | train | Instantiates an instance of this InputReader for the given shard 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/input_readers.py | BlobstoreLineInputReader.validate | def validate(cls, mapper_spec):
"""Validates mapper spec and all mapper parameters.
Args:
mapper_spec: The MapperSpec for this InputReader.
Raises:
BadReaderParamsError: required parameters are missing or invalid.
"""
if mapper_spec.input_reader_class() != cls:
raise BadReaderPar... | python | def validate(cls, mapper_spec):
"""Validates mapper spec and all mapper parameters.
Args:
mapper_spec: The MapperSpec for this InputReader.
Raises:
BadReaderParamsError: required parameters are missing or invalid.
"""
if mapper_spec.input_reader_class() != cls:
raise BadReaderPar... | [
"def",
"validate",
"(",
"cls",
",",
"mapper_spec",
")",
":",
"if",
"mapper_spec",
".",
"input_reader_class",
"(",
")",
"!=",
"cls",
":",
"raise",
"BadReaderParamsError",
"(",
"\"Mapper input reader class mismatch\"",
")",
"params",
"=",
"_get_params",
"(",
"mapper... | Validates mapper spec and all mapper parameters.
Args:
mapper_spec: The MapperSpec for this InputReader.
Raises:
BadReaderParamsError: required parameters are missing or invalid. | [
"Validates",
"mapper",
"spec",
"and",
"all",
"mapper",
"parameters",
"."
] | 2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6 | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/input_readers.py#L1368-L1395 | train | Validates the mapper spec and all required 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/input_readers.py | BlobstoreLineInputReader.split_input | def split_input(cls, mapper_spec):
"""Returns a list of shard_count input_spec_shards for input_spec.
Args:
mapper_spec: The mapper specification to split from. Must contain
'blob_keys' parameter with one or more blob keys.
Returns:
A list of BlobstoreInputReaders corresponding to th... | python | def split_input(cls, mapper_spec):
"""Returns a list of shard_count input_spec_shards for input_spec.
Args:
mapper_spec: The mapper specification to split from. Must contain
'blob_keys' parameter with one or more blob keys.
Returns:
A list of BlobstoreInputReaders corresponding to th... | [
"def",
"split_input",
"(",
"cls",
",",
"mapper_spec",
")",
":",
"params",
"=",
"_get_params",
"(",
"mapper_spec",
")",
"blob_keys",
"=",
"params",
"[",
"cls",
".",
"BLOB_KEYS_PARAM",
"]",
"if",
"isinstance",
"(",
"blob_keys",
",",
"basestring",
")",
":",
"... | Returns a list of shard_count input_spec_shards for input_spec.
Args:
mapper_spec: The mapper specification to split from. Must contain
'blob_keys' parameter with one or more blob keys.
Returns:
A list of BlobstoreInputReaders corresponding to the specified shards. | [
"Returns",
"a",
"list",
"of",
"shard_count",
"input_spec_shards",
"for",
"input_spec",
"."
] | 2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6 | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/input_readers.py#L1398-L1437 | train | Returns a list of shard_count input_spec_shards for the specified shard_count. | 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/input_readers.py | BlobstoreZipInputReader.next | def next(self):
"""Returns the next input from this input reader as (ZipInfo, opener) tuple.
Returns:
The next input from this input reader, in the form of a 2-tuple.
The first element of the tuple is a zipfile.ZipInfo object.
The second element of the tuple is a zero-argument function that, ... | python | def next(self):
"""Returns the next input from this input reader as (ZipInfo, opener) tuple.
Returns:
The next input from this input reader, in the form of a 2-tuple.
The first element of the tuple is a zipfile.ZipInfo object.
The second element of the tuple is a zero-argument function that, ... | [
"def",
"next",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_zip",
":",
"self",
".",
"_zip",
"=",
"zipfile",
".",
"ZipFile",
"(",
"self",
".",
"_reader",
"(",
"self",
".",
"_blob_key",
")",
")",
"# Get a list of entries, reversed so we can pop entries o... | Returns the next input from this input reader as (ZipInfo, opener) tuple.
Returns:
The next input from this input reader, in the form of a 2-tuple.
The first element of the tuple is a zipfile.ZipInfo object.
The second element of the tuple is a zero-argument function that, when
called, retu... | [
"Returns",
"the",
"next",
"input",
"from",
"this",
"input",
"reader",
"as",
"(",
"ZipInfo",
"opener",
")",
"tuple",
"."
] | 2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6 | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/input_readers.py#L1476-L1494 | train | Returns the next input from this input reader as a 2 - tuple. | 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/input_readers.py | BlobstoreZipInputReader._read | def _read(self, entry):
"""Read entry content.
Args:
entry: zip file entry as zipfile.ZipInfo.
Returns:
Entry content as string.
"""
start_time = time.time()
content = self._zip.read(entry.filename)
ctx = context.get()
if ctx:
operation.counters.Increment(COUNTER_IO_R... | python | def _read(self, entry):
"""Read entry content.
Args:
entry: zip file entry as zipfile.ZipInfo.
Returns:
Entry content as string.
"""
start_time = time.time()
content = self._zip.read(entry.filename)
ctx = context.get()
if ctx:
operation.counters.Increment(COUNTER_IO_R... | [
"def",
"_read",
"(",
"self",
",",
"entry",
")",
":",
"start_time",
"=",
"time",
".",
"time",
"(",
")",
"content",
"=",
"self",
".",
"_zip",
".",
"read",
"(",
"entry",
".",
"filename",
")",
"ctx",
"=",
"context",
".",
"get",
"(",
")",
"if",
"ctx",... | Read entry content.
Args:
entry: zip file entry as zipfile.ZipInfo.
Returns:
Entry content as string. | [
"Read",
"entry",
"content",
"."
] | 2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6 | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/input_readers.py#L1496-L1513 | train | Read entry content. | 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/input_readers.py | BlobstoreZipInputReader.from_json | def from_json(cls, json):
"""Creates an instance of the InputReader for the given input shard state.
Args:
json: The InputReader state as a dict-like object.
Returns:
An instance of the InputReader configured using the values of json.
"""
return cls(json[cls.BLOB_KEY_PARAM],
... | python | def from_json(cls, json):
"""Creates an instance of the InputReader for the given input shard state.
Args:
json: The InputReader state as a dict-like object.
Returns:
An instance of the InputReader configured using the values of json.
"""
return cls(json[cls.BLOB_KEY_PARAM],
... | [
"def",
"from_json",
"(",
"cls",
",",
"json",
")",
":",
"return",
"cls",
"(",
"json",
"[",
"cls",
".",
"BLOB_KEY_PARAM",
"]",
",",
"json",
"[",
"cls",
".",
"START_INDEX_PARAM",
"]",
",",
"json",
"[",
"cls",
".",
"END_INDEX_PARAM",
"]",
")"
] | Creates an instance of the InputReader for the given input shard state.
Args:
json: The InputReader state as a dict-like object.
Returns:
An instance of the InputReader configured using the values of json. | [
"Creates",
"an",
"instance",
"of",
"the",
"InputReader",
"for",
"the",
"given",
"input",
"shard",
"state",
"."
] | 2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6 | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/input_readers.py#L1516-L1527 | train | Creates an InputReader instance from the given 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/input_readers.py | BlobstoreZipInputReader.to_json | def to_json(self):
"""Returns an input shard state for the remaining inputs.
Returns:
A json-izable version of the remaining InputReader.
"""
return {self.BLOB_KEY_PARAM: self._blob_key,
self.START_INDEX_PARAM: self._start_index,
self.END_INDEX_PARAM: self._end_index} | python | def to_json(self):
"""Returns an input shard state for the remaining inputs.
Returns:
A json-izable version of the remaining InputReader.
"""
return {self.BLOB_KEY_PARAM: self._blob_key,
self.START_INDEX_PARAM: self._start_index,
self.END_INDEX_PARAM: self._end_index} | [
"def",
"to_json",
"(",
"self",
")",
":",
"return",
"{",
"self",
".",
"BLOB_KEY_PARAM",
":",
"self",
".",
"_blob_key",
",",
"self",
".",
"START_INDEX_PARAM",
":",
"self",
".",
"_start_index",
",",
"self",
".",
"END_INDEX_PARAM",
":",
"self",
".",
"_end_inde... | Returns an input shard state for the remaining inputs.
Returns:
A json-izable version of the remaining InputReader. | [
"Returns",
"an",
"input",
"shard",
"state",
"for",
"the",
"remaining",
"inputs",
"."
] | 2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6 | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/input_readers.py#L1529-L1537 | train | Returns an input shard state for the remaining inputs. | 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/input_readers.py | BlobstoreZipInputReader.validate | def validate(cls, mapper_spec):
"""Validates mapper spec and all mapper parameters.
Args:
mapper_spec: The MapperSpec for this InputReader.
Raises:
BadReaderParamsError: required parameters are missing or invalid.
"""
if mapper_spec.input_reader_class() != cls:
raise BadReaderPar... | python | def validate(cls, mapper_spec):
"""Validates mapper spec and all mapper parameters.
Args:
mapper_spec: The MapperSpec for this InputReader.
Raises:
BadReaderParamsError: required parameters are missing or invalid.
"""
if mapper_spec.input_reader_class() != cls:
raise BadReaderPar... | [
"def",
"validate",
"(",
"cls",
",",
"mapper_spec",
")",
":",
"if",
"mapper_spec",
".",
"input_reader_class",
"(",
")",
"!=",
"cls",
":",
"raise",
"BadReaderParamsError",
"(",
"\"Mapper input reader class mismatch\"",
")",
"params",
"=",
"_get_params",
"(",
"mapper... | Validates mapper spec and all mapper parameters.
Args:
mapper_spec: The MapperSpec for this InputReader.
Raises:
BadReaderParamsError: required parameters are missing or invalid. | [
"Validates",
"mapper",
"spec",
"and",
"all",
"mapper",
"parameters",
"."
] | 2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6 | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/input_readers.py#L1545-L1563 | train | Validates mapper spec and all required 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/input_readers.py | BlobstoreZipInputReader.split_input | def split_input(cls, mapper_spec, _reader=blobstore.BlobReader):
"""Returns a list of input shard states for the input spec.
Args:
mapper_spec: The MapperSpec for this InputReader. Must contain
'blob_key' parameter with one blob key.
_reader: a callable that returns a file-like object for... | python | def split_input(cls, mapper_spec, _reader=blobstore.BlobReader):
"""Returns a list of input shard states for the input spec.
Args:
mapper_spec: The MapperSpec for this InputReader. Must contain
'blob_key' parameter with one blob key.
_reader: a callable that returns a file-like object for... | [
"def",
"split_input",
"(",
"cls",
",",
"mapper_spec",
",",
"_reader",
"=",
"blobstore",
".",
"BlobReader",
")",
":",
"params",
"=",
"_get_params",
"(",
"mapper_spec",
")",
"blob_key",
"=",
"params",
"[",
"cls",
".",
"BLOB_KEY_PARAM",
"]",
"zip_input",
"=",
... | Returns a list of input shard states for the input spec.
Args:
mapper_spec: The MapperSpec for this InputReader. Must contain
'blob_key' parameter with one blob key.
_reader: a callable that returns a file-like object for reading blobs.
Used for dependency injection.
Returns:
... | [
"Returns",
"a",
"list",
"of",
"input",
"shard",
"states",
"for",
"the",
"input",
"spec",
"."
] | 2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6 | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/input_readers.py#L1566-L1601 | train | Splits the input file into several input 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/input_readers.py | BlobstoreZipLineInputReader.split_input | def split_input(cls, mapper_spec, _reader=blobstore.BlobReader):
"""Returns a list of input readers for the input spec.
Args:
mapper_spec: The MapperSpec for this InputReader. Must contain
'blob_keys' parameter with one or more blob keys.
_reader: a callable that returns a file-like objec... | python | def split_input(cls, mapper_spec, _reader=blobstore.BlobReader):
"""Returns a list of input readers for the input spec.
Args:
mapper_spec: The MapperSpec for this InputReader. Must contain
'blob_keys' parameter with one or more blob keys.
_reader: a callable that returns a file-like objec... | [
"def",
"split_input",
"(",
"cls",
",",
"mapper_spec",
",",
"_reader",
"=",
"blobstore",
".",
"BlobReader",
")",
":",
"params",
"=",
"_get_params",
"(",
"mapper_spec",
")",
"blob_keys",
"=",
"params",
"[",
"cls",
".",
"BLOB_KEYS_PARAM",
"]",
"if",
"isinstance... | Returns a list of input readers for the input spec.
Args:
mapper_spec: The MapperSpec for this InputReader. Must contain
'blob_keys' parameter with one or more blob keys.
_reader: a callable that returns a file-like object for reading blobs.
Used for dependency injection.
Retur... | [
"Returns",
"a",
"list",
"of",
"input",
"readers",
"for",
"the",
"input",
"spec",
"."
] | 2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6 | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/input_readers.py#L1688-L1742 | train | Returns a list of InputReaders that can be used to read blobs within the input 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/input_readers.py | BlobstoreZipLineInputReader.next | def next(self):
"""Returns the next line from this input reader as (lineinfo, line) tuple.
Returns:
The next input from this input reader, in the form of a 2-tuple.
The first element of the tuple describes the source, it is itself
a tuple (blobkey, filenumber, byteoffset).
The second ... | python | def next(self):
"""Returns the next line from this input reader as (lineinfo, line) tuple.
Returns:
The next input from this input reader, in the form of a 2-tuple.
The first element of the tuple describes the source, it is itself
a tuple (blobkey, filenumber, byteoffset).
The second ... | [
"def",
"next",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_filestream",
":",
"if",
"not",
"self",
".",
"_zip",
":",
"self",
".",
"_zip",
"=",
"zipfile",
".",
"ZipFile",
"(",
"self",
".",
"_reader",
"(",
"self",
".",
"_blob_key",
")",
")",
... | Returns the next line from this input reader as (lineinfo, line) tuple.
Returns:
The next input from this input reader, in the form of a 2-tuple.
The first element of the tuple describes the source, it is itself
a tuple (blobkey, filenumber, byteoffset).
The second element of the tuple is... | [
"Returns",
"the",
"next",
"line",
"from",
"this",
"input",
"reader",
"as",
"(",
"lineinfo",
"line",
")",
"tuple",
"."
] | 2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6 | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/input_readers.py#L1744-L1781 | train | Returns the next line from this input reader as a 2 - tuple. | 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/input_readers.py | BlobstoreZipLineInputReader._next_offset | def _next_offset(self):
"""Return the offset of the next line to read."""
if self._filestream:
offset = self._filestream.tell()
if offset:
offset -= 1
else:
offset = self._initial_offset
return offset | python | def _next_offset(self):
"""Return the offset of the next line to read."""
if self._filestream:
offset = self._filestream.tell()
if offset:
offset -= 1
else:
offset = self._initial_offset
return offset | [
"def",
"_next_offset",
"(",
"self",
")",
":",
"if",
"self",
".",
"_filestream",
":",
"offset",
"=",
"self",
".",
"_filestream",
".",
"tell",
"(",
")",
"if",
"offset",
":",
"offset",
"-=",
"1",
"else",
":",
"offset",
"=",
"self",
".",
"_initial_offset",... | Return the offset of the next line to read. | [
"Return",
"the",
"offset",
"of",
"the",
"next",
"line",
"to",
"read",
"."
] | 2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6 | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/input_readers.py#L1783-L1792 | train | Return the offset of the next line to read. | 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/input_readers.py | BlobstoreZipLineInputReader.to_json | def to_json(self):
"""Returns an input shard state for the remaining inputs.
Returns:
A json-izable version of the remaining InputReader.
"""
return {self.BLOB_KEY_PARAM: self._blob_key,
self.START_FILE_INDEX_PARAM: self._start_file_index,
self.END_FILE_INDEX_PARAM: self.... | python | def to_json(self):
"""Returns an input shard state for the remaining inputs.
Returns:
A json-izable version of the remaining InputReader.
"""
return {self.BLOB_KEY_PARAM: self._blob_key,
self.START_FILE_INDEX_PARAM: self._start_file_index,
self.END_FILE_INDEX_PARAM: self.... | [
"def",
"to_json",
"(",
"self",
")",
":",
"return",
"{",
"self",
".",
"BLOB_KEY_PARAM",
":",
"self",
".",
"_blob_key",
",",
"self",
".",
"START_FILE_INDEX_PARAM",
":",
"self",
".",
"_start_file_index",
",",
"self",
".",
"END_FILE_INDEX_PARAM",
":",
"self",
".... | Returns an input shard state for the remaining inputs.
Returns:
A json-izable version of the remaining InputReader. | [
"Returns",
"an",
"input",
"shard",
"state",
"for",
"the",
"remaining",
"inputs",
"."
] | 2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6 | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/input_readers.py#L1794-L1804 | train | Returns an input shard state for the remaining inputs. | 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/input_readers.py | BlobstoreZipLineInputReader.from_json | def from_json(cls, json, _reader=blobstore.BlobReader):
"""Creates an instance of the InputReader for the given input shard state.
Args:
json: The InputReader state as a dict-like object.
_reader: For dependency injection.
Returns:
An instance of the InputReader configured using the valu... | python | def from_json(cls, json, _reader=blobstore.BlobReader):
"""Creates an instance of the InputReader for the given input shard state.
Args:
json: The InputReader state as a dict-like object.
_reader: For dependency injection.
Returns:
An instance of the InputReader configured using the valu... | [
"def",
"from_json",
"(",
"cls",
",",
"json",
",",
"_reader",
"=",
"blobstore",
".",
"BlobReader",
")",
":",
"return",
"cls",
"(",
"json",
"[",
"cls",
".",
"BLOB_KEY_PARAM",
"]",
",",
"json",
"[",
"cls",
".",
"START_FILE_INDEX_PARAM",
"]",
",",
"json",
... | Creates an instance of the InputReader for the given input shard state.
Args:
json: The InputReader state as a dict-like object.
_reader: For dependency injection.
Returns:
An instance of the InputReader configured using the values of json. | [
"Creates",
"an",
"instance",
"of",
"the",
"InputReader",
"for",
"the",
"given",
"input",
"shard",
"state",
"."
] | 2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6 | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/input_readers.py#L1807-L1821 | train | Creates an InputReader instance from the given 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/input_readers.py | NamespaceInputReader.to_json | def to_json(self):
"""Serializes all the data in this query range into json form.
Returns:
all the data in json-compatible map.
"""
return {self.NAMESPACE_RANGE_PARAM: self.ns_range.to_json_object(),
self.BATCH_SIZE_PARAM: self._batch_size} | python | def to_json(self):
"""Serializes all the data in this query range into json form.
Returns:
all the data in json-compatible map.
"""
return {self.NAMESPACE_RANGE_PARAM: self.ns_range.to_json_object(),
self.BATCH_SIZE_PARAM: self._batch_size} | [
"def",
"to_json",
"(",
"self",
")",
":",
"return",
"{",
"self",
".",
"NAMESPACE_RANGE_PARAM",
":",
"self",
".",
"ns_range",
".",
"to_json_object",
"(",
")",
",",
"self",
".",
"BATCH_SIZE_PARAM",
":",
"self",
".",
"_batch_size",
"}"
] | Serializes all the data in this query range into json form.
Returns:
all the data in json-compatible map. | [
"Serializes",
"all",
"the",
"data",
"in",
"this",
"query",
"range",
"into",
"json",
"form",
"."
] | 2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6 | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/input_readers.py#L1944-L1951 | train | Serializes all the data in this query range into json - compatible 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/input_readers.py | NamespaceInputReader.from_json | def from_json(cls, json):
"""Create new DatastoreInputReader from the json, encoded by to_json.
Args:
json: json map representation of DatastoreInputReader.
Returns:
an instance of DatastoreInputReader with all data deserialized from json.
"""
return cls(
namespace_range.Namesp... | python | def from_json(cls, json):
"""Create new DatastoreInputReader from the json, encoded by to_json.
Args:
json: json map representation of DatastoreInputReader.
Returns:
an instance of DatastoreInputReader with all data deserialized from json.
"""
return cls(
namespace_range.Namesp... | [
"def",
"from_json",
"(",
"cls",
",",
"json",
")",
":",
"return",
"cls",
"(",
"namespace_range",
".",
"NamespaceRange",
".",
"from_json_object",
"(",
"json",
"[",
"cls",
".",
"NAMESPACE_RANGE_PARAM",
"]",
")",
",",
"json",
"[",
"cls",
".",
"BATCH_SIZE_PARAM",... | Create new DatastoreInputReader from the json, encoded by to_json.
Args:
json: json map representation of DatastoreInputReader.
Returns:
an instance of DatastoreInputReader with all data deserialized from json. | [
"Create",
"new",
"DatastoreInputReader",
"from",
"the",
"json",
"encoded",
"by",
"to_json",
"."
] | 2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6 | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/input_readers.py#L1954-L1966 | train | Create a new DatastoreInputReader from the json encoded by 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/input_readers.py | NamespaceInputReader.validate | def validate(cls, mapper_spec):
"""Validates mapper spec.
Args:
mapper_spec: The MapperSpec for this InputReader.
Raises:
BadReaderParamsError: required parameters are missing or invalid.
"""
if mapper_spec.input_reader_class() != cls:
raise BadReaderParamsError("Input reader cla... | python | def validate(cls, mapper_spec):
"""Validates mapper spec.
Args:
mapper_spec: The MapperSpec for this InputReader.
Raises:
BadReaderParamsError: required parameters are missing or invalid.
"""
if mapper_spec.input_reader_class() != cls:
raise BadReaderParamsError("Input reader cla... | [
"def",
"validate",
"(",
"cls",
",",
"mapper_spec",
")",
":",
"if",
"mapper_spec",
".",
"input_reader_class",
"(",
")",
"!=",
"cls",
":",
"raise",
"BadReaderParamsError",
"(",
"\"Input reader class mismatch\"",
")",
"params",
"=",
"_get_params",
"(",
"mapper_spec",... | Validates mapper spec.
Args:
mapper_spec: The MapperSpec for this InputReader.
Raises:
BadReaderParamsError: required parameters are missing or invalid. | [
"Validates",
"mapper",
"spec",
"."
] | 2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6 | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/input_readers.py#L1969-L1987 | train | Validates the 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/input_readers.py | NamespaceInputReader.split_input | def split_input(cls, mapper_spec):
"""Returns a list of input readers for the input spec.
Args:
mapper_spec: The MapperSpec for this InputReader.
Returns:
A list of InputReaders.
"""
batch_size = int(_get_params(mapper_spec).get(
cls.BATCH_SIZE_PARAM, cls._BATCH_SIZE))
shar... | python | def split_input(cls, mapper_spec):
"""Returns a list of input readers for the input spec.
Args:
mapper_spec: The MapperSpec for this InputReader.
Returns:
A list of InputReaders.
"""
batch_size = int(_get_params(mapper_spec).get(
cls.BATCH_SIZE_PARAM, cls._BATCH_SIZE))
shar... | [
"def",
"split_input",
"(",
"cls",
",",
"mapper_spec",
")",
":",
"batch_size",
"=",
"int",
"(",
"_get_params",
"(",
"mapper_spec",
")",
".",
"get",
"(",
"cls",
".",
"BATCH_SIZE_PARAM",
",",
"cls",
".",
"_BATCH_SIZE",
")",
")",
"shard_count",
"=",
"mapper_sp... | Returns a list of input readers for the input spec.
Args:
mapper_spec: The MapperSpec for this InputReader.
Returns:
A list of InputReaders. | [
"Returns",
"a",
"list",
"of",
"input",
"readers",
"for",
"the",
"input",
"spec",
"."
] | 2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6 | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/input_readers.py#L1990-L2005 | train | Splits the input reader into a list of input readers for the input 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/input_readers.py | LogInputReader.from_json | def from_json(cls, json):
"""Creates an instance of the InputReader for the given input shard's state.
Args:
json: The InputReader state as a dict-like object.
Returns:
An instance of the InputReader configured using the given JSON parameters.
"""
# Strip out unrecognized parameters, a... | python | def from_json(cls, json):
"""Creates an instance of the InputReader for the given input shard's state.
Args:
json: The InputReader state as a dict-like object.
Returns:
An instance of the InputReader configured using the given JSON parameters.
"""
# Strip out unrecognized parameters, a... | [
"def",
"from_json",
"(",
"cls",
",",
"json",
")",
":",
"# Strip out unrecognized parameters, as introduced by b/5960884.",
"params",
"=",
"dict",
"(",
"(",
"str",
"(",
"k",
")",
",",
"v",
")",
"for",
"k",
",",
"v",
"in",
"json",
".",
"iteritems",
"(",
")",... | Creates an instance of the InputReader for the given input shard's state.
Args:
json: The InputReader state as a dict-like object.
Returns:
An instance of the InputReader configured using the given JSON parameters. | [
"Creates",
"an",
"instance",
"of",
"the",
"InputReader",
"for",
"the",
"given",
"input",
"shard",
"s",
"state",
"."
] | 2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6 | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/input_readers.py#L2115-L2133 | train | Creates an InputReader from a given JSON 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/input_readers.py | LogInputReader.to_json | def to_json(self):
"""Returns an input shard state for the remaining inputs.
Returns:
A JSON serializable version of the remaining input to read.
"""
params = dict(self.__params) # Shallow copy.
if self._PROTOTYPE_REQUEST_PARAM in params:
prototype_request = params[self._PROTOTYPE_REQ... | python | def to_json(self):
"""Returns an input shard state for the remaining inputs.
Returns:
A JSON serializable version of the remaining input to read.
"""
params = dict(self.__params) # Shallow copy.
if self._PROTOTYPE_REQUEST_PARAM in params:
prototype_request = params[self._PROTOTYPE_REQ... | [
"def",
"to_json",
"(",
"self",
")",
":",
"params",
"=",
"dict",
"(",
"self",
".",
"__params",
")",
"# Shallow copy.",
"if",
"self",
".",
"_PROTOTYPE_REQUEST_PARAM",
"in",
"params",
":",
"prototype_request",
"=",
"params",
"[",
"self",
".",
"_PROTOTYPE_REQUEST_... | Returns an input shard state for the remaining inputs.
Returns:
A JSON serializable version of the remaining input to read. | [
"Returns",
"an",
"input",
"shard",
"state",
"for",
"the",
"remaining",
"inputs",
"."
] | 2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6 | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/input_readers.py#L2135-L2148 | train | Returns an input shard state for the remaining inputs. | 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/input_readers.py | LogInputReader.split_input | def split_input(cls, mapper_spec):
"""Returns a list of input readers for the given input specification.
Args:
mapper_spec: The MapperSpec for this InputReader.
Returns:
A list of InputReaders.
"""
params = _get_params(mapper_spec)
shard_count = mapper_spec.shard_count
# Pick ... | python | def split_input(cls, mapper_spec):
"""Returns a list of input readers for the given input specification.
Args:
mapper_spec: The MapperSpec for this InputReader.
Returns:
A list of InputReaders.
"""
params = _get_params(mapper_spec)
shard_count = mapper_spec.shard_count
# Pick ... | [
"def",
"split_input",
"(",
"cls",
",",
"mapper_spec",
")",
":",
"params",
"=",
"_get_params",
"(",
"mapper_spec",
")",
"shard_count",
"=",
"mapper_spec",
".",
"shard_count",
"# Pick out the overall start and end times and time step per shard.",
"start_time",
"=",
"params"... | Returns a list of input readers for the given input specification.
Args:
mapper_spec: The MapperSpec for this InputReader.
Returns:
A list of InputReaders. | [
"Returns",
"a",
"list",
"of",
"input",
"readers",
"for",
"the",
"given",
"input",
"specification",
"."
] | 2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6 | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/input_readers.py#L2151-L2178 | train | Splits the input into 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/input_readers.py | LogInputReader.validate | def validate(cls, mapper_spec):
"""Validates the mapper's specification and all necessary parameters.
Args:
mapper_spec: The MapperSpec to be used with this InputReader.
Raises:
BadReaderParamsError: If the user fails to specify both a starting time
and an ending time, or if the starti... | python | def validate(cls, mapper_spec):
"""Validates the mapper's specification and all necessary parameters.
Args:
mapper_spec: The MapperSpec to be used with this InputReader.
Raises:
BadReaderParamsError: If the user fails to specify both a starting time
and an ending time, or if the starti... | [
"def",
"validate",
"(",
"cls",
",",
"mapper_spec",
")",
":",
"if",
"mapper_spec",
".",
"input_reader_class",
"(",
")",
"!=",
"cls",
":",
"raise",
"errors",
".",
"BadReaderParamsError",
"(",
"\"Input reader class mismatch\"",
")",
"params",
"=",
"_get_params",
"(... | Validates the mapper's specification and all necessary parameters.
Args:
mapper_spec: The MapperSpec to be used with this InputReader.
Raises:
BadReaderParamsError: If the user fails to specify both a starting time
and an ending time, or if the starting time is later than the ending
... | [
"Validates",
"the",
"mapper",
"s",
"specification",
"and",
"all",
"necessary",
"parameters",
"."
] | 2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6 | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/input_readers.py#L2181-L2230 | train | Validates the input reader s specification and all necessary 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/input_readers.py | _GoogleCloudStorageInputReader._next_file | def _next_file(self):
"""Find next filename.
self._filenames may need to be expanded via listbucket.
Returns:
None if no more file is left. Filename otherwise.
"""
while True:
if self._bucket_iter:
try:
return self._bucket_iter.next().filename
except StopItera... | python | def _next_file(self):
"""Find next filename.
self._filenames may need to be expanded via listbucket.
Returns:
None if no more file is left. Filename otherwise.
"""
while True:
if self._bucket_iter:
try:
return self._bucket_iter.next().filename
except StopItera... | [
"def",
"_next_file",
"(",
"self",
")",
":",
"while",
"True",
":",
"if",
"self",
".",
"_bucket_iter",
":",
"try",
":",
"return",
"self",
".",
"_bucket_iter",
".",
"next",
"(",
")",
".",
"filename",
"except",
"StopIteration",
":",
"self",
".",
"_bucket_ite... | Find next filename.
self._filenames may need to be expanded via listbucket.
Returns:
None if no more file is left. Filename otherwise. | [
"Find",
"next",
"filename",
"."
] | 2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6 | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/input_readers.py#L2326-L2349 | train | Find next file in the list. | 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/input_readers.py | _GoogleCloudStorageInputReader.validate | def validate(cls, mapper_spec):
"""Validate mapper specification.
Args:
mapper_spec: an instance of model.MapperSpec
Raises:
BadReaderParamsError: if the specification is invalid for any reason such
as missing the bucket name or providing an invalid bucket name.
"""
reader_spec... | python | def validate(cls, mapper_spec):
"""Validate mapper specification.
Args:
mapper_spec: an instance of model.MapperSpec
Raises:
BadReaderParamsError: if the specification is invalid for any reason such
as missing the bucket name or providing an invalid bucket name.
"""
reader_spec... | [
"def",
"validate",
"(",
"cls",
",",
"mapper_spec",
")",
":",
"reader_spec",
"=",
"cls",
".",
"get_params",
"(",
"mapper_spec",
",",
"allow_old",
"=",
"False",
")",
"# Bucket Name is required",
"if",
"cls",
".",
"BUCKET_NAME_PARAM",
"not",
"in",
"reader_spec",
... | Validate mapper specification.
Args:
mapper_spec: an instance of model.MapperSpec
Raises:
BadReaderParamsError: if the specification is invalid for any reason such
as missing the bucket name or providing an invalid bucket name. | [
"Validate",
"mapper",
"specification",
"."
] | 2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6 | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/input_readers.py#L2362-L2405 | train | Validate 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.