App Engine Python SDK  v1.6.9 rev.445
The Python runtime is available as an experimental Preview feature.
Public Member Functions | Public Attributes | List of all members
google.appengine.tools.appcfg.AppVersionUpload Class Reference
Inheritance diagram for google.appengine.tools.appcfg.AppVersionUpload:

Public Member Functions

def __init__
 
def AddFile
 
def Describe
 
def Begin
 
def UploadFile
 
def Precompile
 
def PrecompileBatch
 
def Commit
 
def Deploy
 
def IsReady
 
def StartServing
 
def IsServing
 
def GetLogUrl
 
def IsEndpointsConfigUpdated
 
def Rollback
 
def DoUpload
 

Public Attributes

 rpcserver
 
 config
 
 app_id
 
 module
 
 backend
 
 error_fh
 
 version
 
 params
 
 files
 
 all_files
 
 in_transaction
 
 deployed
 
 started
 
 batching
 
 logging_context
 
 file_batcher
 
 blob_batcher
 
 errorblob_batcher
 
 resource_limits
 

Detailed Description

Provides facilities to upload a new appversion to the hosting service.

Attributes:
  rpcserver: The AbstractRpcServer to use for the upload.
  config: The AppInfoExternal object derived from the app.yaml file.
  app_id: The application string from 'config'.
  version: The version string from 'config'.
  backend: The backend to update, if any.
  files: A dictionary of files to upload to the rpcserver, mapping path to
    hash of the file contents.
  in_transaction: True iff a transaction with the server has started.
    An AppVersionUpload can do only one transaction at a time.
  deployed: True iff the Deploy method has been called.
  started: True iff the StartServing method has been called.
  logging_context: The _ClientDeployLoggingContext for this upload.

Constructor & Destructor Documentation

def google.appengine.tools.appcfg.AppVersionUpload.__init__ (   self,
  rpcserver,
  config,
  module_yaml_path = 'app.yaml',
  backend = None,
  error_fh = None,
  get_version = sdk_update_checker.GetVersionObject,
  usage_reporting = False 
)
Creates a new AppVersionUpload.

Args:
  rpcserver: The RPC server to use. Should be an instance of HttpRpcServer
or TestRpcServer.
  config: An AppInfoExternal object that specifies the configuration for
this application.
  module_yaml_path: The (string) path to the yaml file corresponding to
<config>, relative to the bundle directory.
  backend: If specified, indicates the update applies to the given backend.
The backend name must match an entry in the backends: stanza.
  error_fh: Unexpected HTTPErrors are printed to this file handle.
  get_version: Method for determining the current SDK version. The override
is used for testing.
  usage_reporting: Whether or not to report usage.

Member Function Documentation

def google.appengine.tools.appcfg.AppVersionUpload.AddFile (   self,
  path,
  file_handle 
)
Adds the provided file to the list to be pushed to the server.

Args:
  path: The path the file should be uploaded as.
  file_handle: A stream containing data to upload.
def google.appengine.tools.appcfg.AppVersionUpload.Begin (   self)
Begins the transaction, returning a list of files that need uploading.

All calls to AddFile must be made before calling Begin().

Returns:
  A list of pathnames for files that should be uploaded using UploadFile()
  before Commit() can be called.
def google.appengine.tools.appcfg.AppVersionUpload.Commit (   self)
Commits the transaction, making the new app version available.

All the files returned by Begin() must have been uploaded with UploadFile()
before Commit() can be called.

This tries the new 'deploy' method; if that fails it uses the old 'commit'.

Returns:
  An appinfo.AppInfoSummary if one was returned from the Deploy, None
  otherwise.

Raises:
  RuntimeError: Some required files were not uploaded.
  CannotStartServingError: Another operation is in progress on this version.
def google.appengine.tools.appcfg.AppVersionUpload.Deploy (   self)
Deploys the new app version but does not make it default.

All the files returned by Begin() must have been uploaded with UploadFile()
before Deploy() can be called.

Returns:
  An appinfo.AppInfoSummary if one was returned from the Deploy, None
  otherwise.

Raises:
  RuntimeError: Some required files were not uploaded.
def google.appengine.tools.appcfg.AppVersionUpload.Describe (   self)
Returns a string describing the object being updated.
def google.appengine.tools.appcfg.AppVersionUpload.DoUpload (   self,
  paths,
  openfunc 
)
Uploads a new appversion with the given config and files to the server.

Args:
  paths: An iterator that yields the relative paths of the files to upload.
  openfunc: A function that takes a path and returns a file-like object.

Returns:
  An appinfo.AppInfoSummary if one was returned from the server, None
  otherwise.
def google.appengine.tools.appcfg.AppVersionUpload.GetLogUrl (   self)
Get the URL for the app's logs.
def google.appengine.tools.appcfg.AppVersionUpload.IsEndpointsConfigUpdated (   self)
Check if the Endpoints configuration for this app has been updated.

This should only be called if the app has a Google Cloud Endpoints
handler, or if it's removing one.  The server performs the check to see
if Endpoints support is added/updated/removed, and the response to the
isserving call indicates whether IsEndpointsConfigUpdated should be called.

Raises:
  AssertionError: Deploy has not yet been called.
  CannotStartServingError: There was an unexpected error with the server
response.

Returns:
  True if the configuration has been updated, False if not.
def google.appengine.tools.appcfg.AppVersionUpload.IsReady (   self)
Check if the new app version is ready to serve traffic.

Raises:
  RuntimeError: Deploy has not yet been called.

Returns:
  True if the server returned the app is ready to serve.
def google.appengine.tools.appcfg.AppVersionUpload.IsServing (   self)
Check if the new app version is serving.

Raises:
  RuntimeError: Deploy has not yet been called.
  CannotStartServingError: A bad response was received from the isserving
API call.

Returns:
  (serving, response) Where serving is True if the deployed app version is
serving, False otherwise.  response is a dict containing the parsed
response from the server, or an empty dict if the server's response was
an old style 0/1 response.
def google.appengine.tools.appcfg.AppVersionUpload.Precompile (   self)
Handle precompilation.
def google.appengine.tools.appcfg.AppVersionUpload.PrecompileBatch (   self,
  files 
)
Precompile a batch of files.

Args:
  files: Either an empty list (for the initial request) or a list
of files to be precompiled.

Returns:
  Either an empty list (if no more files need to be precompiled)
  or a list of files to be precompiled subsequently.
def google.appengine.tools.appcfg.AppVersionUpload.Rollback (   self)
Rolls back the transaction if one is in progress.
def google.appengine.tools.appcfg.AppVersionUpload.StartServing (   self)
Start serving with the newly created version.

Raises:
  RuntimeError: Deploy has not yet been called.

Returns:
  The response body, as a string.
def google.appengine.tools.appcfg.AppVersionUpload.UploadFile (   self,
  path,
  file_handle 
)
Uploads a file to the hosting service.

Must only be called after Begin().
The path provided must be one of those that were returned by Begin().

Args:
  path: The path the file is being uploaded as.
  file_handle: A file-like object containing the data to upload.

Raises:
  KeyError: The provided file is not amongst those to be uploaded.

The documentation for this class was generated from the following file: