I just have two comments / questions (I'm playing devils advocate
here).
1. It'd be nice if there was a comment at the beginning of the block
=20
saying why the try blocks need to be nested (for the uninformed ones
=20
like me).
2. What should be the policy with respect to particular (or minimum)
=20
version numbers for the dependencies? Is there a general Apache =20
guideline with respect to this or is this handled on a per project =20
basis? The reason for my question is that at some point, addressing
=20
all the corner cases (e.g., backward compatibility and others)
becomes =20=
an obstacle for easy code maintenance.
- Julio
On Jan 8, 2009, at 11:51 AM, Daniel Mercer wrote:
Howdy,
Prior to 2.5, to get try/except/finally behavior you need to nest =20
two try blocks =97 one of the so-called =91python warts=92. Here is
a =20=
patch to client.py that ought to let it work with earlier pythons.
Dan M.
Index: client.py
=
3D
=
3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=
3D
=
3D
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- client.py (revision 732752)
+++ client.py (working copy)
@@ -162,21 +162,22 @@
sys.exit(-1)
args =3D map(lambda x: eval(x), sys.argv[1:])
try:
- res =3D f(*args)
- if (os.getenv("USE_HTML_TABLES")):
- try:
- makeHTMLTable(res)
- except:
+ try:
+ res =3D f(*args)
+ if (os.getenv("USE_HTML_TABLES")):
+ try:
+ makeHTMLTable(res)
+ except:
+ pprint(res)
+ else:
pprint(res)
- else:
- pprint(res)
- except TashiException, e:
- print e.msg
- exitCode =3D e.errno
- except TypeError, e:
- print e
- print "\t" + getFunctionInfo(function)
- exitCode =3D -1
+ except TashiException, e:
+ print e.msg
+ exitCode =3D e.errno
+ except TypeError, e:
+ print e
+ print "\t" + getFunctionInfo(function)
+ exitCode =3D -1
finally:
client._transport.close()
sys.exit(exitCode)
On 1/8/09 7:34 AM, "Ryan, Michael P" <[email protected]>
wrote:
I did a little more reading on the finally clause and it appears =20
that it only started working in it's current form on python2.5.
I installed CentOS 5.2 and I was able to get the same error message
=20=
with python 2.4.3, but once I installed 2.5.4, the messages went
away.
Can you try running the following and report the version numbers?
$ /usr/bin/env python
$ /usr/bin/python
If either reports 2.4.3, I think you only need to change the #! at
=20
the top of the file (client.py) to point to python2.5
- Michael
From: Ryan, Michael P [mailto:[email protected]]
Sent: Wednesday, January 07, 2009 5:54 PM
To: [email protected]
Cc: KunWang
Subject: RE: [question] getting tashi run smoothly
Those with_statement imports are unneccessary. I just committed a
=20
fix that removes them. Just for reference, I am using Python 2.5.2.
Please try using trunk instead of the imported code (tashi/trunk =20
instead of tashi/import/tashi-intel-r399).
I'm not sure why "finally" would be considered a syntax error. I'm
=20=
assuming you didn't modify the code once you checked it out.
I'm currently downloading and installing CentOS 5 to test on and I
=20
will let you know if I am able to reproduce the error.
The only other things I can think of checking are to revert to the
=20
older version of python now that the with imports are removed and
to =20=
make sure you have identical files:
$ md5sum ./trunk/src/tashi/client/client.py ./import/tashi-intel-=20
r399/src/tashi/client/client.py
de302c54d3236e468ba7c2e82d6ceafe ./trunk/src/tashi/client/client.py
7e9eabb435e989272a7a4d620f53f6ba ./import/tashi-intel-r399/src/=20
tashi/client/client.py
- Michael
From: KunWang [mailto:[email protected]]
Sent: Tuesday, January 06, 2009 7:37 PM
To: Ryan, Michael P
Cc: [email protected]
Subject: RE: [question] getting tashi run smoothly
Hello,
Thanks for your help.
I am using Xen on CentOS 5.0 .
The default version of python is 2.4.3.
Following is the log when I was trying to do =93make=94 under tashi-
=20=
intel-r399 directory.
[r...@mvm tashi-intel-r399]# make
Building tashi.services...
File "./build.py", line 3
from __future__ import with_statement
SyntaxError: future feature with_statement is not defined
make: *** [src/tashi/services] Error 1
Then I installed newer version of Python(Python 2.5.4)
The error happened in different place.
[root@ mvm tashi-intel-r399]# make
Building tashi.services...
Generating Python code for 'services.thrift'...
Copying generated code to 'tashi.services' package...
Generatign Python code for 'messagingthrift'...
Copying generated code to 'tashi.messaging.messagingthrift'
package...
Generating client symlinks...
File "../src/tashi/client/client.py", line 163
finally:
^
SyntaxError: invalid syntax
make: *** [bin/getInstances] Error 1
Does tashi require particular version of Python?
By the way, thrift is available on my machine.
Thanks again,
Kun
From: Ryan, Michael P [mailto:[email protected]]
Sent: Monday, January 05, 2009 11:28 AM
To: KunWang
Cc: [email protected]
Subject: RE: [question] get tashi run smoothly
Using migration in Tashi is dependent on using the migration =20
provided by the VMM underneath it. Are you using Qemu/KVM or Xen?
=20=
If you are using Qemu/KVM, you need to be aware of some of the =20
limitations inherent in that VMM's implementation of live migration
=20=
(the disk image has to be served from the same file server, etc.).
The Makefile exists to reorganize the source tree to be usable --
as =20=
you stated, python is not a compiled language. It also uses thrift
=20=
to dynamically create some python code. I suspect you would see =20
many errors if you didn't have thrift installed. Thrift is another
=20=
Apache Incubator project (http://incubator.apache.org/thrift/).
I'm glad to see you're trying to use Tashi and I'm glad to help you
=20=
however I can. If you need more specific directions, we're working
=20=
on some, but in the mean time, please send any error messages you =20
are getting so that I can respond to those individually. The only
=20
request I have is that you send questions like this to =
[email protected]=20
, which is CC'd on this message. Thanks.
- Michael
From: KunWang [mailto:[email protected]]
Sent: Friday, January 02, 2009 11:29 AM
To: Ryan, Michael P
Subject: [question] get tashi run smoothly
Dear Michael,
I watched your talk on =
http://blogs.intel.com/research/2008/10/cloud_computing_in_pittsburgh.php=20=
.
=46rom your talk, I find you are already using tashi for
migration. =20=
However, I encountered some problem
when I was trying to use tashi to establish cloud computing =20
environment in my lab.
I checked out my source code from
http://incubator.apache.org/tashi/source_code.html
I followed this tutorial to use tashi
http://opencirrus.intel-research.net/index.php/Using_Tashi
I found there are several Makefiles in the source tree. Except
for =20=
the utilities, many error happened when
I was trying to use GNU make to =93compile=94 the source code.
Since Python is an interpretive language, I found the Makefile =20
didn=92t do too much concrete job. I can=92t find
enough documents on that website on installing tashi.
I am very interested in tashi. Could you please give me some advice
=20=
to get tashi run smoothly like you?
Thanks in advance.
Regards,
Kun