[google-appengine] Re: unique identifier for server process

2008-10-09 Thread yejun

Or create an empty datastore object. Its id will be globally unique.

On Oct 9, 12:30 pm, Tony Arkles <[EMAIL PROTECTED]> wrote:
> I just used a random number within an import (since imports only
> happen once per instance, it should persist for the lifetime of the
> process)
>
> On Oct 9, 12:56 am, Josh Heitzman <[EMAIL PROTECTED]> wrote:
>
> > The state of the process is not of interest, just which instance of
> > many processes it is (i.e. there is no process specific state to store
> > and query).  I've got side entities all setup so that I can reliably
> > make multi-entity group changes (i.e. processing will continue across
> > requests, even from different clients).
>
> > I'm currently just using a random number as a process instance
> > identity, to determine if a change was left hanging by the same
> > process so its write lock (custom not GAE) can be expired immediately,
> > as the processes are not threaded, rather then waiting the full
> > timeout period.  Rather then a random number I could use an entity key
> > path, but that's more time consuming to generate and then it needs to
> > periodically have a datetime field updated so the staleness of it can
> > be used determined if the entity can be deleted.
>
> > I figure GAE already got some kind of process identifier around
> > (likely an entity in the datastore) as part of the infrastructure, so
> > its just a matter of providing an API to access it (I don't care if
> > its hashed if there some concern about security, but there shouldn't
> > be since one app is never supposed to be able to get any data outside
> > its domain).
>
> > On Oct 8, 9:27 pm, pr3d4t0r <[EMAIL PROTECTED]> wrote:
>
> > > On Oct 8, 6:03 pm, Josh Heitzman <[EMAIL PROTECTED]> wrote:
>
> > > > As os.getpid is not supported by GAE, is there another API that
> > > > provides a unique (preferably across all of GAE) identifier for the
> > > > process?  I'd like to use this to identify if an incomplete update
> > > > sequence (spanning entity groups, so no it can't be done in a
> > > > transaction) was left hanging by the current process or another, as if
> > > > it was the current it can be immediately restarted, where as if it is
> > > > another, it'll have to wait a time period before continuing the
> > > > sequence.
>
> > > Because of the distributed nature of App Engine, about the only way
> > > you have of ensuring that something committed/finished to completion
> > > is to use transactions and entities.  You could create an entity group
> > > that tracks your process(es) state and updates it as various stages
> > > are completed.  Remember that there is no guarantee that your process
> > > will run on any given machine across subsequent calls.
>
> > > Cheers,
>
> > > pr3d4t0rhttp://www.istheserverup.comhttp://www.teslatestament.com
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appengine@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~--~~~~--~~--~--~---



[google-appengine] Re: unique identifier for server process

2008-10-09 Thread Jon McAlister

A random number computed at startup is your best bet. We intentionally
do not provide a way to learn the real process id or the id of the
machine.

On Oct 8, 11:56 pm, Josh Heitzman <[EMAIL PROTECTED]> wrote:
> The state of the process is not of interest, just which instance of
> many processes it is (i.e. there is no process specific state to store
> and query).  I've got side entities all setup so that I can reliably
> make multi-entity group changes (i.e. processing will continue across
> requests, even from different clients).
>
> I'm currently just using a random number as a process instance
> identity, to determine if a change was left hanging by the same
> process so its write lock (custom not GAE) can be expired immediately,
> as the processes are not threaded, rather then waiting the full
> timeout period.  Rather then a random number I could use an entity key
> path, but that's more time consuming to generate and then it needs to
> periodically have a datetime field updated so the staleness of it can
> be used determined if the entity can be deleted.
>
> I figure GAE already got some kind of process identifier around
> (likely an entity in the datastore) as part of the infrastructure, so
> its just a matter of providing an API to access it (I don't care if
> its hashed if there some concern about security, but there shouldn't
> be since one app is never supposed to be able to get any data outside
> its domain).
>
> On Oct 8, 9:27 pm, pr3d4t0r <[EMAIL PROTECTED]> wrote:
>
> > On Oct 8, 6:03 pm, Josh Heitzman <[EMAIL PROTECTED]> wrote:
>
> > > As os.getpid is not supported by GAE, is there another API that
> > > provides a unique (preferably across all of GAE) identifier for the
> > > process?  I'd like to use this to identify if an incomplete update
> > > sequence (spanning entity groups, so no it can't be done in a
> > > transaction) was left hanging by the current process or another, as if
> > > it was the current it can be immediately restarted, where as if it is
> > > another, it'll have to wait a time period before continuing the
> > > sequence.
>
> > Because of the distributed nature of App Engine, about the only way
> > you have of ensuring that something committed/finished to completion
> > is to use transactions and entities.  You could create an entity group
> > that tracks your process(es) state and updates it as various stages
> > are completed.  Remember that there is no guarantee that your process
> > will run on any given machine across subsequent calls.
>
> > Cheers,
>
> > pr3d4t0rhttp://www.istheserverup.comhttp://www.teslatestament.com
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appengine@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~--~~~~--~~--~--~---



[google-appengine] Re: unique identifier for server process

2008-10-09 Thread Tony Arkles

I just used a random number within an import (since imports only
happen once per instance, it should persist for the lifetime of the
process)


On Oct 9, 12:56 am, Josh Heitzman <[EMAIL PROTECTED]> wrote:
> The state of the process is not of interest, just which instance of
> many processes it is (i.e. there is no process specific state to store
> and query).  I've got side entities all setup so that I can reliably
> make multi-entity group changes (i.e. processing will continue across
> requests, even from different clients).
>
> I'm currently just using a random number as a process instance
> identity, to determine if a change was left hanging by the same
> process so its write lock (custom not GAE) can be expired immediately,
> as the processes are not threaded, rather then waiting the full
> timeout period.  Rather then a random number I could use an entity key
> path, but that's more time consuming to generate and then it needs to
> periodically have a datetime field updated so the staleness of it can
> be used determined if the entity can be deleted.
>
> I figure GAE already got some kind of process identifier around
> (likely an entity in the datastore) as part of the infrastructure, so
> its just a matter of providing an API to access it (I don't care if
> its hashed if there some concern about security, but there shouldn't
> be since one app is never supposed to be able to get any data outside
> its domain).
>
> On Oct 8, 9:27 pm, pr3d4t0r <[EMAIL PROTECTED]> wrote:
>
> > On Oct 8, 6:03 pm, Josh Heitzman <[EMAIL PROTECTED]> wrote:
>
> > > As os.getpid is not supported by GAE, is there another API that
> > > provides a unique (preferably across all of GAE) identifier for the
> > > process?  I'd like to use this to identify if an incomplete update
> > > sequence (spanning entity groups, so no it can't be done in a
> > > transaction) was left hanging by the current process or another, as if
> > > it was the current it can be immediately restarted, where as if it is
> > > another, it'll have to wait a time period before continuing the
> > > sequence.
>
> > Because of the distributed nature of App Engine, about the only way
> > you have of ensuring that something committed/finished to completion
> > is to use transactions and entities.  You could create an entity group
> > that tracks your process(es) state and updates it as various stages
> > are completed.  Remember that there is no guarantee that your process
> > will run on any given machine across subsequent calls.
>
> > Cheers,
>
> > pr3d4t0rhttp://www.istheserverup.comhttp://www.teslatestament.com
>
>
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appengine@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~--~~~~--~~--~--~---



[google-appengine] Re: unique identifier for server process

2008-10-08 Thread Josh Heitzman

The state of the process is not of interest, just which instance of
many processes it is (i.e. there is no process specific state to store
and query).  I've got side entities all setup so that I can reliably
make multi-entity group changes (i.e. processing will continue across
requests, even from different clients).

I'm currently just using a random number as a process instance
identity, to determine if a change was left hanging by the same
process so its write lock (custom not GAE) can be expired immediately,
as the processes are not threaded, rather then waiting the full
timeout period.  Rather then a random number I could use an entity key
path, but that's more time consuming to generate and then it needs to
periodically have a datetime field updated so the staleness of it can
be used determined if the entity can be deleted.

I figure GAE already got some kind of process identifier around
(likely an entity in the datastore) as part of the infrastructure, so
its just a matter of providing an API to access it (I don't care if
its hashed if there some concern about security, but there shouldn't
be since one app is never supposed to be able to get any data outside
its domain).

On Oct 8, 9:27 pm, pr3d4t0r <[EMAIL PROTECTED]> wrote:
> On Oct 8, 6:03 pm, Josh Heitzman <[EMAIL PROTECTED]> wrote:
>
> > As os.getpid is not supported by GAE, is there another API that
> > provides a unique (preferably across all of GAE) identifier for the
> > process?  I'd like to use this to identify if an incomplete update
> > sequence (spanning entity groups, so no it can't be done in a
> > transaction) was left hanging by the current process or another, as if
> > it was the current it can be immediately restarted, where as if it is
> > another, it'll have to wait a time period before continuing the
> > sequence.
>
> Because of the distributed nature of App Engine, about the only way
> you have of ensuring that something committed/finished to completion
> is to use transactions and entities.  You could create an entity group
> that tracks your process(es) state and updates it as various stages
> are completed.  Remember that there is no guarantee that your process
> will run on any given machine across subsequent calls.
>
> Cheers,
>
> pr3d4t0rhttp://www.istheserverup.comhttp://www.teslatestament.com
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appengine@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~--~~~~--~~--~--~---



[google-appengine] Re: unique identifier for server process

2008-10-08 Thread pr3d4t0r

On Oct 8, 6:03 pm, Josh Heitzman <[EMAIL PROTECTED]> wrote:
> As os.getpid is not supported by GAE, is there another API that
> provides a unique (preferably across all of GAE) identifier for the
> process?  I'd like to use this to identify if an incomplete update
> sequence (spanning entity groups, so no it can't be done in a
> transaction) was left hanging by the current process or another, as if
> it was the current it can be immediately restarted, where as if it is
> another, it'll have to wait a time period before continuing the
> sequence.

Because of the distributed nature of App Engine, about the only way
you have of ensuring that something committed/finished to completion
is to use transactions and entities.  You could create an entity group
that tracks your process(es) state and updates it as various stages
are completed.  Remember that there is no guarantee that your process
will run on any given machine across subsequent calls.

Cheers,

pr3d4t0r
http://www.istheserverup.com
http://www.teslatestament.com

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appengine@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~--~~~~--~~--~--~---