Profiling Plone/Zope - plone

What is current best practice for profiling Plone/Zope applications on a Plone 4.1/Zope 2.13 system?
Products.ZopeProfiler and the Plone.org version of CallProfiler both fail at install time with:
Traceback (most recent call last):
File "/home/derek/plone4/buildout-cache/eggs/Zope2-2.13.10-py2.6.egg/OFS/Application.py", line 689, in install_product
initmethod(context)
File "/home/derek/plone4/buildout-cache/eggs/Products.ZopeProfiler-2.0.1-py2.6.egg/Products/ZopeProfiler/__init__.py", line 8, in initialize
control_panel = context._ProductContext__app.Control_Panel
AttributeError: 'NoneType' object has no attribute 'Control_Panel'
z3c.profiler wants to install a lot of apparently-incompatible dependencies (not surprising since it's intended for Zope3).
collective.profiler looks promising, and installs, but doesn't let me profile the __call__ method of a View, because the method doesn't have a __dict__ attribute.

Have a look at repoze.profile and it's documentation. It runs as WSGI middleware component which aggregates profiling data across all requests to the WSGI application.

The ZopeProfiler in Version 2.0.2 works just fine with Plone 4.1

Related

Airflow SQSSensor message filtering

Given below json:
{ "Model" : "level1" }
what is the right combination of message_filtering_match_values and message_filtering_config values? I try below but it fails:
model_operator = SQSSensor(
task_id='model_operator',
dag=dag,
sqs_queue='https://sqs.somewhere/somequeue.fifo',
aws_conn_id='aws_default',
message_filtering='jsonpath',
message_filtering_config='Model[*]',
message_filtering_match_values=['level1'],
mode='reschedule')
Error message is:
Broken DAG: [/usr/local/airflow/dags/test_dag.py] Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/airflow/utils/decorators.py", line 94, in wrapper
result = func(*args, **kwargs)
File "/usr/local/lib/python3.7/site-packages/airflow/models/baseoperator.py", line 414, in __init__
"arguments were:\n**kwargs: {k}".format(c=self.__class__.__name__, k=kwargs, t=task_id),
airflow.exceptions.AirflowException: Invalid arguments were passed to SQSSensor (task_id: model_operator). Invalid arguments were:
**kwargs: {'message_filtering': 'jsonpath', 'message_filtering_config': 'Model[*]', 'message_filtering_match_values': ['level1']}
The message_filtering / message_filtering_config / message_filtering_match_values were added recently in PR it was released in Amazon provider version 2.2.0
From the traceback we can see that these parameters are not recognized by the operator which means that you are running an older version of the Amazon provider.
You should upgrade the Amazon provider to the latest version.
pip install apache-airflow-providers-amazon --upgrade
It's also recommended to read the documentation about constraint files.
You didn't mention what Airflow version you are running nor what version of the Amazon provider so note to read the change logs in case you are upgrading major version.

Swift authentication when try to connect via API

I am a team member of research group and my current research needs to use Openstack Swift.
We have installed Openstack Juno and it works perfectly. For installation Packstack have used used. The swift service is also installed on the server and it works! We have tried to access it from the console create container, upload a file etc. everything works.
So we went further and tried to access swift using its API. Here we faced a problem on the phase of authentication.
Below you can see the simple python code I am using to check if I can connect to Swift.
import swiftclient
import keystoneclient
conn = swiftclient.Connection(
authurl='http://*[server ip]*:5000/v2.0/',
user='account_name:username',
key='serverpassword',
auth_version="2.0").get_auth()[0]
for container in conn.get_account()[1]:
print container['name']
Before executing the cod on client computer, I have installed the following necessary packages.
sudo aptitude install python-pip
sudo pip install python-swiftclient
sudo pip install python-keystoneclient
Here you can see the error which occurs during execution of the code.
Traceback (most recent call last):
File "new.py", line 15, in <module>
auth_version="2.0").get_auth()[0]
File "/usr/local/lib/python2.7/dist-packages/swiftclient/client.py", line 1332, in get_auth
timeout=self.timeout)
File "/usr/local/lib/python2.7/dist-packages/swiftclient/client.py", line 463, in get_auth
auth_version=auth_version)
File "/usr/local/lib/python2.7/dist-packages/swiftclient/client.py", line 366, in get_auth_keystone
ksclient, exceptions = _import_keystone_client(auth_version)
File "/usr/local/lib/python2.7/dist-packages/swiftclient/client.py", line 351, in _import_keystone_client
variables to be set or overridden with -A, -U, or -K.''')
swiftclient.exceptions.ClientException:
Auth versions 2.0 and 3 require python-keystoneclient, install it or use Auth
version 1.0 which requires ST_AUTH, ST_USER, and ST_KEY environment
variables to be set or overridden with -A, -U, or -K.
I have tried to find the solution searching in the Internet but I have not succeed.

EC2 starcluster stopped working

Starcluster on EC2 ubuntu stopped working. I am not aware of any intentional configuration change or anything else and am unable to find much help. Can you please tell me if anyone has any suggestions? starting, terminating, or even listing clusters is erroring out. Below is the error I am getting when I try to listclusters:
ubuntu#ip-10-29-249-203:~$ starcluster listclusters
StarCluster - (http://star.mit.edu/cluster) (v. 0.94)
Software Tools for Academics and Researchers (STAR)
Please submit bug reports to starcluster#mit.edu
---------------------------------
revcls (security group: #sc-revcls)
---------------------------------
!!! ERROR - Unhandled exception occured
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/StarCluster-0.94-py2.7.egg/starcluster/cli.py", line 274, in main
sc.execute(args)
File "/usr/local/lib/python2.7/dist-packages/StarCluster-0.94-py2.7.egg/starcluster/commands/listclusters.py", line 36, in execute
show_ssh_status=self.opts.show_ssh_status)
File "/usr/local/lib/python2.7/dist-packages/StarCluster-0.94-py2.7.egg/starcluster/cluster.py", line 290, in list_clusters
nodes = cl.nodes
File "/usr/local/lib/python2.7/dist-packages/StarCluster-0.94-py2.7.egg/starcluster/cluster.py", line 720, in nodes
if n.is_master():
File "/usr/local/lib/python2.7/dist-packages/StarCluster-0.94-py2.7.egg/starcluster/node.py", line 883, in is_master
return self.alias == "master"
File "/usr/local/lib/python2.7/dist-packages/StarCluster-0.94-py2.7.egg/starcluster/node.py", line 139, in alias
aliases = aliasestxt.splitlines()[2:]
AttributeError: 'NoneType' object has no attribute 'splitlines'
!!! ERROR - Oops! Looks like you've found a bug in StarCluster
!!! ERROR - Crash report written to: /home/ubuntu/.starcluster/logs/crash-report-1183.txt
!!! ERROR - Please remove any sensitive data from the crash report
!!! ERROR - and submit it to starcluster#mit.edu
Which version of StarCluster are you using? Is it the latest release or the latest dev version?
If I look at your error on the latest dev version, it refers to this line:
https://github.com/jtriley/StarCluster/blob/5442e91e159acca48b645f5ddf629d65c59cd7e0/starcluster/node.py#L139
My guess is that you are having an issue with your cluster alias tags. In any cases, it's very strange that even terminating the cluster and starting a new one doesn't solve the issue.
If you find anything more, can reproduce the issue or need more help, you may also use StarCluster mailing list. http://mailman.mit.edu/mailman/listinfo/starcluster

Using zopyx.smartprintng.plone receive "[Errno 111] Connection refused" when trying to generate PDF

Overview
A client contacted us requesting that when they fill in a form on their site (created with PloneFormGen), they want the input of the form sent to the customer in PDF format (the converted form must be then printed, signed and posted back to the customer).
I jumped on the Plone.org IRC room and asked the guys there, they suggested I use the zopyx.smartprintng.plone add-on. This seemed perfect because they have a script adapter example for PloneFormGen that I can use to convert the form input into a PDF file.
The docs for the add-on are on this page:
http://docs.produce-and-publish.com/#produce-publish-client-connector
Going on that I was told I only needed to install the "Produce and Publish Client Connector" I proceeded to follow the installation instructions on the documentation.
The Installation
The buildout installation went fine, it reported no errors at all and my buildout reflects exactly what they state it must on that installation documentation page.
However I noticed that under "Add/Remove Add-ons" in the Plone Control Panel, I could see no reference to this add-on, thus preventing me from actually enabling it on the particular site I am working on. (I have a feeling this may be the cause of the problem I am experiencing, but I have no idea how to resolve it). - I have checked portal_quickinstaller and it's not there either.
The Problem
According to the documentation appending ##asPlainPDF to the URL of the page you want to render will then render the PDF for you.
So I enter mysite.com/front-page/##asPlainPDF in my browser.
Upon doing this I receive this traceback:
Traceback (innermost last):
Module ZPublisher.Publish, line 126, in publish
Module ZPublisher.mapply, line 77, in mapply
Module ZPublisher.Publish, line 46, in call_object
Module zopyx.smartprintng.plone.browser.pdf, line 249, in __call__
Module zopyx.smartprintng.plone.browser.pdf, line 85, in __call__
Module zopyx.smartprintng.plone.browser.pdf, line 232, in __call2__
Module zopyx.smartprintng.client.zip_client, line 192, in convertZIP2
Module xmlrpclib, line 1224, in __call__
Module xmlrpclib, line 1578, in __request
Module xmlrpclib, line 1264, in request
Module xmlrpclib, line 1292, in single_request
Module xmlrpclib, line 1439, in send_content
Module httplib, line 954, in endheaders
Module httplib, line 814, in _send_output
Module httplib, line 776, in send
Module httplib, line 757, in connect
Module socket, line 571, in create_connection
error: [Errno 111] Connection refused
If you need more information than this please tell me where to get it and I shall provide it to you.
I have Google'd the error: [Errno 111] Connection refused message but it is either people experiencing issues with a Python program they are writing or a different add-on named zopyx.smartprintng.lite
I did find this thread however: https://groups.google.com/forum/#!msg/plone-users/wCuO4RCUIQk/VslwOXvs4XwJ
So as one user suggested I tried installing zopyx.smartprintng.server however that started complaining that I had the wrong version of zope.configuration, and wants >=3.8.0dev upon pinning that to 4.0.2 as it was the latest I could find, it then started complaining about another add-on and I got some buildout errors, which then bricked my Plone server (stopped the clients from coming up) and I had to re-run buildout from a backup buildout.cfg I made so it would make the necessary zope.conf files.
Server information
Plone 4.2.1.1 (4207)
CMF 2.2.6
Zope 2.13.16
Python 2.7.3 (default, Oct 18 2012, 15:13:00) [GCC 4.6.3]
Summary
Followed these installation instructions:
http://docs.produce-and-publish.com/#produce-publish-client-connector
Received the above traceback trying to convert PDF when appending ##asPlainPDF to URL
Attempts to install zopyx.smartprintng.server have failed.
The Produce-and-publish set of components does indeed require the server to be set up. The Plone product you installed is merely the integration point between Plone and that server.
Please to follow the instructions on http://docs.produce-and-publish.com/server/installation.html to install that separate server (it can have it's own buildout).
(If you run into problems with that installation, feel free to ask a new question here on Stack Overflow, or ask on the Plone Users mailinglist, or contact the author (which may require you to pay Zopyx for such support)).

How to clean unused add-ons from a Plone site?

This is a general question but motivated by an example. The general question is: How to clean Plone sites from unused add-ons? You can generate an unused add-on in several ways, for example if you use one add-one for one thing and later you prefer another.
I'm starting learning about Plone and maybe I'm making some mistakes. But I think that some add-ons can make problems because they left some things that are not automatically uninstalled. Then my question is also about how to isolate the data from the possible add-ons footprints.
So, this is the example:
When I started with Plone I installed an add-on named zettwerk.ui. But later I uninstalled it. I removed the add-on using the Plone web interface and the buildout configuration. Then I got the problem: every time that I try to install another add-on an error message appears:
2012-04-28 00:21:54 INFO GenericSetup.rolemap Role / permission map imported.
2012-04-28 00:21:54 INFO GenericSetup.archetypetool Archetype tool imported.
2012-04-28 00:21:54 INFO GenericSetup.browserlayer Browser layers imported
2012-04-28 00:21:54 INFO GenericSetup.resourceregistry KSS registry imported.
2012-04-28 00:21:54 ERROR GenericSetup Step zettwerk.ui.disable_sunburst_patch has an invalid import handler
2012-04-28 00:21:54 INFO GenericSetup.rolemap Role / permission map imported.
2012-04-28 00:21:54 INFO GenericSetup.toolset Class zettwerk.ui.tool.tool.UITool not found for tool portal_ui_tool
2012-04-28 00:21:54 ERROR Zope.SiteErrorLog 1335586914.990.0334188015457 http://localhost:8080/Plone/portal_quickinstaller/installProducts
Traceback (innermost last):
Module ZPublisher.Publish, line 126, in publish
Module ZPublisher.mapply, line 77, in mapply
Module Products.PDBDebugMode.runcall, line 70, in pdb_runcall
Module ZPublisher.Publish, line 46, in call_object
Module Products.CMFQuickInstallerTool.QuickInstallerTool, line 575, in installProducts
Module Products.CMFQuickInstallerTool.QuickInstallerTool, line 512, in installProduct
- __traceback_info__: ('plone.app.theming',)
Module Products.GenericSetup.tool, line 323, in runAllImportStepsFromProfile
- __traceback_info__: profile-plone.app.theming:default
Module Products.GenericSetup.tool, line 1080, in _runImportStepsFromContext
Module Products.GenericSetup.tool, line 994, in _doRunImportStep
- __traceback_info__: toolset
Module Products.GenericSetup.tool, line 123, in importToolset
TypeError: 'NoneType' object is not callable
> /home/daniel/.buildout/eggs/Products.GenericSetup-1.6.3-py2.6.egg/Products/GenericSetup/tool.py(123)importToolset()
-> new_tool = tool_class(tool_id)
I put zettwerk.ui back in buildout.conf and then the error disappears. But I think that the solution is not clean. So, how can I remove zettwerk.ui from buildout without making problems?
This has been fixed in GenericSetup 1.6.5:
http://pypi.python.org/pypi/Products.GenericSetup/1.6.5
Updating to that version (included in Plone 4.1.4) should do the trick.
(Latest stable release currently is Plone 4.1.5 with GenericSetup 1.6.6, so I would say go for that one.)
Explanation: during install, zettwerk.ui has told GenericSetup that it requires a tool. This tool is then created. During uninstall, the tool is removed, but it is still in the list of required tools. If zettwerk.ui is uninstalled but the package is still in your buildout and you install another add-on, then GenericSetup looks at the list of required tools and creates this tool again. When zettwerk.ui is not available, this will fail with the above error. GenericSetup 1.6.5 simply prints a warning in this case and happily continues.
I don't think wildcard.fixpersistentutilities works in this case, but I may be mistaken. For some reason I have so far managed to avoid needing that package.
There are two possibilities.
First, do a backup :-)
Simplest, if the zettwerk.ui product you reinstalled is not the same version as the one you originally added, try reinstalling it. Product removal has been much improved over the years, and fewer products now exhibit this behavior.
If you still have the problem, add the product wildcard.fixpersistentutilities to your buildout, rerun the buildout, and navigate to /##fix-persistent-utilities on your site, looking for anything on that page that references zettwerk.ui. Remove it. Once you have no more references there, remove the zettwerk.ui product.
Actually, there's a third possibility: add a patch to zettwerk.ui to fix its uninstall!

Resources