1 2<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> 3<html><head><title>Python: module telemetry.page.cloud_storage</title> 4</head><body bgcolor="#f0f0f8"> 5 6<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading"> 7<tr bgcolor="#7799ee"> 8<td valign=bottom> <br> 9<font color="#ffffff" face="helvetica, arial"> <br><big><big><strong><a href="telemetry.html"><font color="#ffffff">telemetry</font></a>.<a href="telemetry.page.html"><font color="#ffffff">page</font></a>.cloud_storage</strong></big></big></font></td 10><td align=right valign=bottom 11><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="../telemetry/page/cloud_storage.py">telemetry/page/cloud_storage.py</a></font></td></tr></table> 12 <p><tt>Wrappers for gsutil, for basic interaction with Google Cloud Storage.</tt></p> 13<p> 14<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> 15<tr bgcolor="#aa55cc"> 16<td colspan=3 valign=bottom> <br> 17<font color="#ffffff" face="helvetica, arial"><big><strong>Modules</strong></big></font></td></tr> 18 19<tr><td bgcolor="#aa55cc"><tt> </tt></td><td> </td> 20<td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=top><a href="cStringIO.html">cStringIO</a><br> 21<a href="hashlib.html">hashlib</a><br> 22<a href="logging.html">logging</a><br> 23</td><td width="25%" valign=top><a href="os.html">os</a><br> 24<a href="subprocess.html">subprocess</a><br> 25<a href="sys.html">sys</a><br> 26</td><td width="25%" valign=top><a href="tarfile.html">tarfile</a><br> 27<a href="urllib2.html">urllib2</a><br> 28<a href="telemetry.core.util.html">telemetry.core.util</a><br> 29</td><td width="25%" valign=top></td></tr></table></td></tr></table><p> 30<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> 31<tr bgcolor="#ee77aa"> 32<td colspan=3 valign=bottom> <br> 33<font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr> 34 35<tr><td bgcolor="#ee77aa"><tt> </tt></td><td> </td> 36<td width="100%"><dl> 37<dt><font face="helvetica, arial"><a href="exceptions.html#Exception">exceptions.Exception</a>(<a href="exceptions.html#BaseException">exceptions.BaseException</a>) 38</font></dt><dd> 39<dl> 40<dt><font face="helvetica, arial"><a href="telemetry.page.cloud_storage.html#CloudStorageError">CloudStorageError</a> 41</font></dt><dd> 42<dl> 43<dt><font face="helvetica, arial"><a href="telemetry.page.cloud_storage.html#CredentialsError">CredentialsError</a> 44</font></dt><dt><font face="helvetica, arial"><a href="telemetry.page.cloud_storage.html#NotFoundError">NotFoundError</a> 45</font></dt><dt><font face="helvetica, arial"><a href="telemetry.page.cloud_storage.html#PermissionError">PermissionError</a> 46</font></dt></dl> 47</dd> 48</dl> 49</dd> 50</dl> 51 <p> 52<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> 53<tr bgcolor="#ffc8d8"> 54<td colspan=3 valign=bottom> <br> 55<font color="#000000" face="helvetica, arial"><a name="CloudStorageError">class <strong>CloudStorageError</strong></a>(<a href="exceptions.html#Exception">exceptions.Exception</a>)</font></td></tr> 56 57<tr><td bgcolor="#ffc8d8"><tt> </tt></td><td> </td> 58<td width="100%"><dl><dt>Method resolution order:</dt> 59<dd><a href="telemetry.page.cloud_storage.html#CloudStorageError">CloudStorageError</a></dd> 60<dd><a href="exceptions.html#Exception">exceptions.Exception</a></dd> 61<dd><a href="exceptions.html#BaseException">exceptions.BaseException</a></dd> 62<dd><a href="__builtin__.html#object">__builtin__.object</a></dd> 63</dl> 64<hr> 65Data descriptors defined here:<br> 66<dl><dt><strong>__weakref__</strong></dt> 67<dd><tt>list of weak references to the object (if defined)</tt></dd> 68</dl> 69<hr> 70Methods inherited from <a href="exceptions.html#Exception">exceptions.Exception</a>:<br> 71<dl><dt><a name="CloudStorageError-__init__"><strong>__init__</strong></a>(...)</dt><dd><tt>x.<a href="#CloudStorageError-__init__">__init__</a>(...) initializes x; see help(type(x)) for signature</tt></dd></dl> 72 73<hr> 74Data and other attributes inherited from <a href="exceptions.html#Exception">exceptions.Exception</a>:<br> 75<dl><dt><strong>__new__</strong> = <built-in method __new__ of type object><dd><tt>T.<a href="#CloudStorageError-__new__">__new__</a>(S, ...) -> a new object with type S, a subtype of T</tt></dl> 76 77<hr> 78Methods inherited from <a href="exceptions.html#BaseException">exceptions.BaseException</a>:<br> 79<dl><dt><a name="CloudStorageError-__delattr__"><strong>__delattr__</strong></a>(...)</dt><dd><tt>x.<a href="#CloudStorageError-__delattr__">__delattr__</a>('name') <==> del x.name</tt></dd></dl> 80 81<dl><dt><a name="CloudStorageError-__getattribute__"><strong>__getattribute__</strong></a>(...)</dt><dd><tt>x.<a href="#CloudStorageError-__getattribute__">__getattribute__</a>('name') <==> x.name</tt></dd></dl> 82 83<dl><dt><a name="CloudStorageError-__getitem__"><strong>__getitem__</strong></a>(...)</dt><dd><tt>x.<a href="#CloudStorageError-__getitem__">__getitem__</a>(y) <==> x[y]</tt></dd></dl> 84 85<dl><dt><a name="CloudStorageError-__getslice__"><strong>__getslice__</strong></a>(...)</dt><dd><tt>x.<a href="#CloudStorageError-__getslice__">__getslice__</a>(i, j) <==> x[i:j]<br> 86 <br> 87Use of negative indices is not supported.</tt></dd></dl> 88 89<dl><dt><a name="CloudStorageError-__reduce__"><strong>__reduce__</strong></a>(...)</dt></dl> 90 91<dl><dt><a name="CloudStorageError-__repr__"><strong>__repr__</strong></a>(...)</dt><dd><tt>x.<a href="#CloudStorageError-__repr__">__repr__</a>() <==> repr(x)</tt></dd></dl> 92 93<dl><dt><a name="CloudStorageError-__setattr__"><strong>__setattr__</strong></a>(...)</dt><dd><tt>x.<a href="#CloudStorageError-__setattr__">__setattr__</a>('name', value) <==> x.name = value</tt></dd></dl> 94 95<dl><dt><a name="CloudStorageError-__setstate__"><strong>__setstate__</strong></a>(...)</dt></dl> 96 97<dl><dt><a name="CloudStorageError-__str__"><strong>__str__</strong></a>(...)</dt><dd><tt>x.<a href="#CloudStorageError-__str__">__str__</a>() <==> str(x)</tt></dd></dl> 98 99<dl><dt><a name="CloudStorageError-__unicode__"><strong>__unicode__</strong></a>(...)</dt></dl> 100 101<hr> 102Data descriptors inherited from <a href="exceptions.html#BaseException">exceptions.BaseException</a>:<br> 103<dl><dt><strong>__dict__</strong></dt> 104</dl> 105<dl><dt><strong>args</strong></dt> 106</dl> 107<dl><dt><strong>message</strong></dt> 108</dl> 109</td></tr></table> <p> 110<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> 111<tr bgcolor="#ffc8d8"> 112<td colspan=3 valign=bottom> <br> 113<font color="#000000" face="helvetica, arial"><a name="CredentialsError">class <strong>CredentialsError</strong></a>(<a href="telemetry.page.cloud_storage.html#CloudStorageError">CloudStorageError</a>)</font></td></tr> 114 115<tr><td bgcolor="#ffc8d8"><tt> </tt></td><td> </td> 116<td width="100%"><dl><dt>Method resolution order:</dt> 117<dd><a href="telemetry.page.cloud_storage.html#CredentialsError">CredentialsError</a></dd> 118<dd><a href="telemetry.page.cloud_storage.html#CloudStorageError">CloudStorageError</a></dd> 119<dd><a href="exceptions.html#Exception">exceptions.Exception</a></dd> 120<dd><a href="exceptions.html#BaseException">exceptions.BaseException</a></dd> 121<dd><a href="__builtin__.html#object">__builtin__.object</a></dd> 122</dl> 123<hr> 124Methods defined here:<br> 125<dl><dt><a name="CredentialsError-__init__"><strong>__init__</strong></a>(self, gsutil_path)</dt></dl> 126 127<hr> 128Data descriptors inherited from <a href="telemetry.page.cloud_storage.html#CloudStorageError">CloudStorageError</a>:<br> 129<dl><dt><strong>__weakref__</strong></dt> 130<dd><tt>list of weak references to the object (if defined)</tt></dd> 131</dl> 132<hr> 133Data and other attributes inherited from <a href="exceptions.html#Exception">exceptions.Exception</a>:<br> 134<dl><dt><strong>__new__</strong> = <built-in method __new__ of type object><dd><tt>T.<a href="#CredentialsError-__new__">__new__</a>(S, ...) -> a new object with type S, a subtype of T</tt></dl> 135 136<hr> 137Methods inherited from <a href="exceptions.html#BaseException">exceptions.BaseException</a>:<br> 138<dl><dt><a name="CredentialsError-__delattr__"><strong>__delattr__</strong></a>(...)</dt><dd><tt>x.<a href="#CredentialsError-__delattr__">__delattr__</a>('name') <==> del x.name</tt></dd></dl> 139 140<dl><dt><a name="CredentialsError-__getattribute__"><strong>__getattribute__</strong></a>(...)</dt><dd><tt>x.<a href="#CredentialsError-__getattribute__">__getattribute__</a>('name') <==> x.name</tt></dd></dl> 141 142<dl><dt><a name="CredentialsError-__getitem__"><strong>__getitem__</strong></a>(...)</dt><dd><tt>x.<a href="#CredentialsError-__getitem__">__getitem__</a>(y) <==> x[y]</tt></dd></dl> 143 144<dl><dt><a name="CredentialsError-__getslice__"><strong>__getslice__</strong></a>(...)</dt><dd><tt>x.<a href="#CredentialsError-__getslice__">__getslice__</a>(i, j) <==> x[i:j]<br> 145 <br> 146Use of negative indices is not supported.</tt></dd></dl> 147 148<dl><dt><a name="CredentialsError-__reduce__"><strong>__reduce__</strong></a>(...)</dt></dl> 149 150<dl><dt><a name="CredentialsError-__repr__"><strong>__repr__</strong></a>(...)</dt><dd><tt>x.<a href="#CredentialsError-__repr__">__repr__</a>() <==> repr(x)</tt></dd></dl> 151 152<dl><dt><a name="CredentialsError-__setattr__"><strong>__setattr__</strong></a>(...)</dt><dd><tt>x.<a href="#CredentialsError-__setattr__">__setattr__</a>('name', value) <==> x.name = value</tt></dd></dl> 153 154<dl><dt><a name="CredentialsError-__setstate__"><strong>__setstate__</strong></a>(...)</dt></dl> 155 156<dl><dt><a name="CredentialsError-__str__"><strong>__str__</strong></a>(...)</dt><dd><tt>x.<a href="#CredentialsError-__str__">__str__</a>() <==> str(x)</tt></dd></dl> 157 158<dl><dt><a name="CredentialsError-__unicode__"><strong>__unicode__</strong></a>(...)</dt></dl> 159 160<hr> 161Data descriptors inherited from <a href="exceptions.html#BaseException">exceptions.BaseException</a>:<br> 162<dl><dt><strong>__dict__</strong></dt> 163</dl> 164<dl><dt><strong>args</strong></dt> 165</dl> 166<dl><dt><strong>message</strong></dt> 167</dl> 168</td></tr></table> <p> 169<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> 170<tr bgcolor="#ffc8d8"> 171<td colspan=3 valign=bottom> <br> 172<font color="#000000" face="helvetica, arial"><a name="NotFoundError">class <strong>NotFoundError</strong></a>(<a href="telemetry.page.cloud_storage.html#CloudStorageError">CloudStorageError</a>)</font></td></tr> 173 174<tr><td bgcolor="#ffc8d8"><tt> </tt></td><td> </td> 175<td width="100%"><dl><dt>Method resolution order:</dt> 176<dd><a href="telemetry.page.cloud_storage.html#NotFoundError">NotFoundError</a></dd> 177<dd><a href="telemetry.page.cloud_storage.html#CloudStorageError">CloudStorageError</a></dd> 178<dd><a href="exceptions.html#Exception">exceptions.Exception</a></dd> 179<dd><a href="exceptions.html#BaseException">exceptions.BaseException</a></dd> 180<dd><a href="__builtin__.html#object">__builtin__.object</a></dd> 181</dl> 182<hr> 183Data descriptors inherited from <a href="telemetry.page.cloud_storage.html#CloudStorageError">CloudStorageError</a>:<br> 184<dl><dt><strong>__weakref__</strong></dt> 185<dd><tt>list of weak references to the object (if defined)</tt></dd> 186</dl> 187<hr> 188Methods inherited from <a href="exceptions.html#Exception">exceptions.Exception</a>:<br> 189<dl><dt><a name="NotFoundError-__init__"><strong>__init__</strong></a>(...)</dt><dd><tt>x.<a href="#NotFoundError-__init__">__init__</a>(...) initializes x; see help(type(x)) for signature</tt></dd></dl> 190 191<hr> 192Data and other attributes inherited from <a href="exceptions.html#Exception">exceptions.Exception</a>:<br> 193<dl><dt><strong>__new__</strong> = <built-in method __new__ of type object><dd><tt>T.<a href="#NotFoundError-__new__">__new__</a>(S, ...) -> a new object with type S, a subtype of T</tt></dl> 194 195<hr> 196Methods inherited from <a href="exceptions.html#BaseException">exceptions.BaseException</a>:<br> 197<dl><dt><a name="NotFoundError-__delattr__"><strong>__delattr__</strong></a>(...)</dt><dd><tt>x.<a href="#NotFoundError-__delattr__">__delattr__</a>('name') <==> del x.name</tt></dd></dl> 198 199<dl><dt><a name="NotFoundError-__getattribute__"><strong>__getattribute__</strong></a>(...)</dt><dd><tt>x.<a href="#NotFoundError-__getattribute__">__getattribute__</a>('name') <==> x.name</tt></dd></dl> 200 201<dl><dt><a name="NotFoundError-__getitem__"><strong>__getitem__</strong></a>(...)</dt><dd><tt>x.<a href="#NotFoundError-__getitem__">__getitem__</a>(y) <==> x[y]</tt></dd></dl> 202 203<dl><dt><a name="NotFoundError-__getslice__"><strong>__getslice__</strong></a>(...)</dt><dd><tt>x.<a href="#NotFoundError-__getslice__">__getslice__</a>(i, j) <==> x[i:j]<br> 204 <br> 205Use of negative indices is not supported.</tt></dd></dl> 206 207<dl><dt><a name="NotFoundError-__reduce__"><strong>__reduce__</strong></a>(...)</dt></dl> 208 209<dl><dt><a name="NotFoundError-__repr__"><strong>__repr__</strong></a>(...)</dt><dd><tt>x.<a href="#NotFoundError-__repr__">__repr__</a>() <==> repr(x)</tt></dd></dl> 210 211<dl><dt><a name="NotFoundError-__setattr__"><strong>__setattr__</strong></a>(...)</dt><dd><tt>x.<a href="#NotFoundError-__setattr__">__setattr__</a>('name', value) <==> x.name = value</tt></dd></dl> 212 213<dl><dt><a name="NotFoundError-__setstate__"><strong>__setstate__</strong></a>(...)</dt></dl> 214 215<dl><dt><a name="NotFoundError-__str__"><strong>__str__</strong></a>(...)</dt><dd><tt>x.<a href="#NotFoundError-__str__">__str__</a>() <==> str(x)</tt></dd></dl> 216 217<dl><dt><a name="NotFoundError-__unicode__"><strong>__unicode__</strong></a>(...)</dt></dl> 218 219<hr> 220Data descriptors inherited from <a href="exceptions.html#BaseException">exceptions.BaseException</a>:<br> 221<dl><dt><strong>__dict__</strong></dt> 222</dl> 223<dl><dt><strong>args</strong></dt> 224</dl> 225<dl><dt><strong>message</strong></dt> 226</dl> 227</td></tr></table> <p> 228<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> 229<tr bgcolor="#ffc8d8"> 230<td colspan=3 valign=bottom> <br> 231<font color="#000000" face="helvetica, arial"><a name="PermissionError">class <strong>PermissionError</strong></a>(<a href="telemetry.page.cloud_storage.html#CloudStorageError">CloudStorageError</a>)</font></td></tr> 232 233<tr><td bgcolor="#ffc8d8"><tt> </tt></td><td> </td> 234<td width="100%"><dl><dt>Method resolution order:</dt> 235<dd><a href="telemetry.page.cloud_storage.html#PermissionError">PermissionError</a></dd> 236<dd><a href="telemetry.page.cloud_storage.html#CloudStorageError">CloudStorageError</a></dd> 237<dd><a href="exceptions.html#Exception">exceptions.Exception</a></dd> 238<dd><a href="exceptions.html#BaseException">exceptions.BaseException</a></dd> 239<dd><a href="__builtin__.html#object">__builtin__.object</a></dd> 240</dl> 241<hr> 242Methods defined here:<br> 243<dl><dt><a name="PermissionError-__init__"><strong>__init__</strong></a>(self, gsutil_path)</dt></dl> 244 245<hr> 246Data descriptors inherited from <a href="telemetry.page.cloud_storage.html#CloudStorageError">CloudStorageError</a>:<br> 247<dl><dt><strong>__weakref__</strong></dt> 248<dd><tt>list of weak references to the object (if defined)</tt></dd> 249</dl> 250<hr> 251Data and other attributes inherited from <a href="exceptions.html#Exception">exceptions.Exception</a>:<br> 252<dl><dt><strong>__new__</strong> = <built-in method __new__ of type object><dd><tt>T.<a href="#PermissionError-__new__">__new__</a>(S, ...) -> a new object with type S, a subtype of T</tt></dl> 253 254<hr> 255Methods inherited from <a href="exceptions.html#BaseException">exceptions.BaseException</a>:<br> 256<dl><dt><a name="PermissionError-__delattr__"><strong>__delattr__</strong></a>(...)</dt><dd><tt>x.<a href="#PermissionError-__delattr__">__delattr__</a>('name') <==> del x.name</tt></dd></dl> 257 258<dl><dt><a name="PermissionError-__getattribute__"><strong>__getattribute__</strong></a>(...)</dt><dd><tt>x.<a href="#PermissionError-__getattribute__">__getattribute__</a>('name') <==> x.name</tt></dd></dl> 259 260<dl><dt><a name="PermissionError-__getitem__"><strong>__getitem__</strong></a>(...)</dt><dd><tt>x.<a href="#PermissionError-__getitem__">__getitem__</a>(y) <==> x[y]</tt></dd></dl> 261 262<dl><dt><a name="PermissionError-__getslice__"><strong>__getslice__</strong></a>(...)</dt><dd><tt>x.<a href="#PermissionError-__getslice__">__getslice__</a>(i, j) <==> x[i:j]<br> 263 <br> 264Use of negative indices is not supported.</tt></dd></dl> 265 266<dl><dt><a name="PermissionError-__reduce__"><strong>__reduce__</strong></a>(...)</dt></dl> 267 268<dl><dt><a name="PermissionError-__repr__"><strong>__repr__</strong></a>(...)</dt><dd><tt>x.<a href="#PermissionError-__repr__">__repr__</a>() <==> repr(x)</tt></dd></dl> 269 270<dl><dt><a name="PermissionError-__setattr__"><strong>__setattr__</strong></a>(...)</dt><dd><tt>x.<a href="#PermissionError-__setattr__">__setattr__</a>('name', value) <==> x.name = value</tt></dd></dl> 271 272<dl><dt><a name="PermissionError-__setstate__"><strong>__setstate__</strong></a>(...)</dt></dl> 273 274<dl><dt><a name="PermissionError-__str__"><strong>__str__</strong></a>(...)</dt><dd><tt>x.<a href="#PermissionError-__str__">__str__</a>() <==> str(x)</tt></dd></dl> 275 276<dl><dt><a name="PermissionError-__unicode__"><strong>__unicode__</strong></a>(...)</dt></dl> 277 278<hr> 279Data descriptors inherited from <a href="exceptions.html#BaseException">exceptions.BaseException</a>:<br> 280<dl><dt><strong>__dict__</strong></dt> 281</dl> 282<dl><dt><strong>args</strong></dt> 283</dl> 284<dl><dt><strong>message</strong></dt> 285</dl> 286</td></tr></table></td></tr></table><p> 287<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> 288<tr bgcolor="#eeaa77"> 289<td colspan=3 valign=bottom> <br> 290<font color="#ffffff" face="helvetica, arial"><big><strong>Functions</strong></big></font></td></tr> 291 292<tr><td bgcolor="#eeaa77"><tt> </tt></td><td> </td> 293<td width="100%"><dl><dt><a name="-Delete"><strong>Delete</strong></a>(bucket, remote_path)</dt></dl> 294 <dl><dt><a name="-Exists"><strong>Exists</strong></a>(bucket, remote_path)</dt></dl> 295 <dl><dt><a name="-FindGsutil"><strong>FindGsutil</strong></a>()</dt><dd><tt>Return the gsutil executable path. If we can't find it, download it.</tt></dd></dl> 296 <dl><dt><a name="-Get"><strong>Get</strong></a>(bucket, remote_path, local_path)</dt></dl> 297 <dl><dt><a name="-GetHash"><strong>GetHash</strong></a>(file_path)</dt><dd><tt>Calculates and returns the hash of the file at file_path.</tt></dd></dl> 298 <dl><dt><a name="-GetIfChanged"><strong>GetIfChanged</strong></a>(file_path, bucket<font color="#909090">=None</font>)</dt><dd><tt>Gets the file at file_path if it has a hash file that doesn't match.<br> 299 <br> 300If the file is not in Cloud Storage, log a warning instead of raising an<br> 301exception. We assume that the user just hasn't uploaded the file yet.<br> 302 <br> 303Returns:<br> 304 True if the binary was changed.</tt></dd></dl> 305 <dl><dt><a name="-Insert"><strong>Insert</strong></a>(bucket, remote_path, local_path, publicly_readable<font color="#909090">=False</font>)</dt></dl> 306 <dl><dt><a name="-List"><strong>List</strong></a>(bucket)</dt></dl> 307 <dl><dt><a name="-Move"><strong>Move</strong></a>(bucket1, bucket2, remote_path)</dt></dl> 308 <dl><dt><a name="-SupportsProdaccess"><strong>SupportsProdaccess</strong></a>(gsutil_path)</dt></dl> 309</td></tr></table><p> 310<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> 311<tr bgcolor="#55aa55"> 312<td colspan=3 valign=bottom> <br> 313<font color="#ffffff" face="helvetica, arial"><big><strong>Data</strong></big></font></td></tr> 314 315<tr><td bgcolor="#55aa55"><tt> </tt></td><td> </td> 316<td width="100%"><strong>INTERNAL_BUCKET</strong> = 'chrome-telemetry'<br> 317<strong>PARTNER_BUCKET</strong> = 'chrome-partner-telemetry'<br> 318<strong>PUBLIC_BUCKET</strong> = 'chromium-telemetry'</td></tr></table> 319</body></html>