Search Results

Search found 6 results on 1 pages for 'ento'.

Page 1/1 | 1 

  • cherrypy fails to stop when puppet tries to ensure running and refresh it at the same time

    - by ento
    I am trying to manage a cherrypy service with puppet. However, when the configuration is applied, cherryd ends up with no PID file although the process is up and running. Since the PID file is lost I can no longer stop the process with /etc/init.d/mycherryd stop (unless I modify the handmade init script to lookup the PID with ps or something.) $ /etc/init.d/mycherryd status cherryd dead but subsys locked The problem seems to be that puppet is trying to refresh/restart cherryd (triggered by changes in configuration files) immediately after ensuring it's running (as specified in the manifest), and cherrypy fails to stop and start (restart) itself while still executing its startup process. Is there a clear cut solution to this problem? Is this a bug on the cherrypy side, or can I write a puppet manifest so refresh is called only after the service is up and running? Any suggestion welcome. cherrypy log See how cherrypy catches SIGTERM midway through startup and still starts to listen. :cherrypy.error[18666] 2010-02-12 13:10:23,551 INFO: ENGINE Listening for SIGHUP. :cherrypy.error[18666] 2010-02-12 13:10:23,552 INFO: ENGINE Listening for SIGTERM. :cherrypy.error[18666] 2010-02-12 13:10:23,552 INFO: ENGINE Listening for SIGUSR1. :cherrypy.error[18666] 2010-02-12 13:10:23,552 INFO: ENGINE Bus STARTING :cherrypy.error[18671] 2010-02-12 13:10:23,554 INFO: ENGINE Daemonized to PID: 18671 :cherrypy.error[18671] 2010-02-12 13:10:23,554 INFO: ENGINE PID 18671 written to '/var/mycherryd/cherry.pid'. :cherrypy.error[18671] 2010-02-12 13:10:23,555 INFO: ENGINE Started monitor thread '_TimeoutMonitor'. :cherrypy.error[18670] 2010-02-12 13:10:23,556 INFO: ENGINE Forking twice. :cherrypy.error[18666] 2010-02-12 13:10:23,557 INFO: ENGINE Forking once. :cherrypy.error[18671] 2010-02-12 13:10:23,716 INFO: ENGINE Caught signal SIGTERM. :cherrypy.error[18671] 2010-02-12 13:10:23,716 INFO: ENGINE Bus STOPPING :cherrypy.error[18671] 2010-02-12 13:10:23,716 INFO: ENGINE HTTP Server cherrypy._cpwsgi_server.CPWSGIServer(('0.0.0.0', 12380)) already shut down :cherrypy.error[18671] 2010-02-12 13:10:23,717 INFO: ENGINE Stopped thread '_TimeoutMonitor'. :cherrypy.error[18671] 2010-02-12 13:10:23,717 INFO: ENGINE Bus STOPPED :cherrypy.error[18671] 2010-02-12 13:10:23,732 INFO: ENGINE Bus EXITING :cherrypy.error[18671] 2010-02-12 13:10:23,759 INFO: ENGINE PID file removed: '/var/mycherryd/cherry.pid'. :cherrypy.error[18671] 2010-02-12 13:10:23,782 INFO: ENGINE Bus EXITED :cherrypy.error[18671] 2010-02-12 13:10:23,792 INFO: ENGINE Serving on 0.0.0.0:12380 :cherrypy.error[18671] 2010-02-12 13:10:23,826 INFO: ENGINE Bus STARTED puppet log puppet tries to refresh the service immediately after ensuring it to be 'running'. Feb 12 13:10:22 localhost puppetd[8159]: (//mycherrypy/File[conffiles]) Scheduling refresh of Service[cherryd] Feb 12 13:10:22 localhost last message repeated 12 times Feb 12 13:10:23 localhost puppetd[8159]: (//mycherrypy/Service[mycherryd]/ensure) ensure changed 'stopped' to 'running' Feb 12 13:10:23 localhost puppetd[8159]: (//mycherrypy/Service[mycherryd]) Triggering 'refresh' from 13 dependencies Feb 12 13:11:23 localhost puppetd[8159]: (//mycherrypy/Service[mycherryd]) Failed to call refresh on Service[mycherryd]: Could not stop Service[mycherryd]: Execution of '/sbin/service mycherryd stop' returned 1: at /etc/puppet/manifests/mycherrypy.pp:161 Feb 12 13:11:24 localhost puppetd[8159]: Value of 'preferred_serialization_format' (pson) is invalid for report, using default (marshal) Feb 12 13:11:24 localhost puppetd[8159]: Finished catalog run in 99.25 seconds puppet manifest excerpt class mycherrypy { file { 'rpm': path => "/tmp/${apiserver}.i386.rpm", source => "${fileserver}/${apiserver}.i386.rpm"; 'conffiles': require => Package["${apiserver}"], path => "${service_home}/config/", ensure => present, source => "${fileserver}/config/", notify => Service["mycherryd"]; } package { "$apiserver": provider => 'rpm', source => "/tmp/${apiserver}.i386.rpm", ensure => latest; } service { "mycherryd": require => [File["conffiles"], Package["${apiserver}"]], ensure => running, provider => redhat, hasstatus => true; } }

    Read the article

  • cherrypy fails to stop when puppet tries to ensure running and refresh it at the same time

    - by ento
    I am trying to manage a cherrypy service with puppet. However, when the configuration is applied, cherryd ends up with no PID file although the process is up and running. Since the PID file is lost I can no longer stop the process with /etc/init.d/mycherryd stop (unless I modify the handmade init script to lookup the PID with ps or something.) $ /etc/init.d/mycherryd status cherryd dead but subsys locked The problem seems to be that puppet is trying to refresh/restart cherryd (triggered by changes in configuration files) immediately after ensuring it's running (as specified in the manifest), and cherrypy fails to stop and start (restart) itself while still executing its startup process. Is there a clear cut solution to this problem? Is this a bug on the cherrypy side, or can I write a puppet manifest so refresh is called only after the service is up and running? Any suggestion welcome. cherrypy log See how cherrypy catches SIGTERM midway through startup and still starts to listen. :cherrypy.error[18666] 2010-02-12 13:10:23,551 INFO: ENGINE Listening for SIGHUP. :cherrypy.error[18666] 2010-02-12 13:10:23,552 INFO: ENGINE Listening for SIGTERM. :cherrypy.error[18666] 2010-02-12 13:10:23,552 INFO: ENGINE Listening for SIGUSR1. :cherrypy.error[18666] 2010-02-12 13:10:23,552 INFO: ENGINE Bus STARTING :cherrypy.error[18671] 2010-02-12 13:10:23,554 INFO: ENGINE Daemonized to PID: 18671 :cherrypy.error[18671] 2010-02-12 13:10:23,554 INFO: ENGINE PID 18671 written to '/var/mycherryd/cherry.pid'. :cherrypy.error[18671] 2010-02-12 13:10:23,555 INFO: ENGINE Started monitor thread '_TimeoutMonitor'. :cherrypy.error[18670] 2010-02-12 13:10:23,556 INFO: ENGINE Forking twice. :cherrypy.error[18666] 2010-02-12 13:10:23,557 INFO: ENGINE Forking once. :cherrypy.error[18671] 2010-02-12 13:10:23,716 INFO: ENGINE Caught signal SIGTERM. :cherrypy.error[18671] 2010-02-12 13:10:23,716 INFO: ENGINE Bus STOPPING :cherrypy.error[18671] 2010-02-12 13:10:23,716 INFO: ENGINE HTTP Server cherrypy._cpwsgi_server.CPWSGIServer(('0.0.0.0', 12380)) already shut down :cherrypy.error[18671] 2010-02-12 13:10:23,717 INFO: ENGINE Stopped thread '_TimeoutMonitor'. :cherrypy.error[18671] 2010-02-12 13:10:23,717 INFO: ENGINE Bus STOPPED :cherrypy.error[18671] 2010-02-12 13:10:23,732 INFO: ENGINE Bus EXITING :cherrypy.error[18671] 2010-02-12 13:10:23,759 INFO: ENGINE PID file removed: '/var/mycherryd/cherry.pid'. :cherrypy.error[18671] 2010-02-12 13:10:23,782 INFO: ENGINE Bus EXITED :cherrypy.error[18671] 2010-02-12 13:10:23,792 INFO: ENGINE Serving on 0.0.0.0:12380 :cherrypy.error[18671] 2010-02-12 13:10:23,826 INFO: ENGINE Bus STARTED puppet log puppet tries to refresh the service immediately after ensuring it to be 'running'. Feb 12 13:10:22 localhost puppetd[8159]: (//mycherrypy/File[conffiles]) Scheduling refresh of Service[cherryd] Feb 12 13:10:22 localhost last message repeated 12 times Feb 12 13:10:23 localhost puppetd[8159]: (//mycherrypy/Service[mycherryd]/ensure) ensure changed 'stopped' to 'running' Feb 12 13:10:23 localhost puppetd[8159]: (//mycherrypy/Service[mycherryd]) Triggering 'refresh' from 13 dependencies Feb 12 13:11:23 localhost puppetd[8159]: (//mycherrypy/Service[mycherryd]) Failed to call refresh on Service[mycherryd]: Could not stop Service[mycherryd]: Execution of '/sbin/service mycherryd stop' returned 1: at /etc/puppet/manifests/mycherrypy.pp:161 Feb 12 13:11:24 localhost puppetd[8159]: Value of 'preferred_serialization_format' (pson) is invalid for report, using default (marshal) Feb 12 13:11:24 localhost puppetd[8159]: Finished catalog run in 99.25 seconds puppet manifest excerpt class mycherrypy { file { 'rpm': path => "/tmp/${apiserver}.i386.rpm", source => "${fileserver}/${apiserver}.i386.rpm"; 'conffiles': require => Package["${apiserver}"], path => "${service_home}/config/", ensure => present, source => "${fileserver}/config/", notify => Service["mycherryd"]; } package { "$apiserver": provider => 'rpm', source => "/tmp/${apiserver}.i386.rpm", ensure => latest; } service { "mycherryd": require => [File["conffiles"], Package["${apiserver}"]], ensure => running, provider => redhat, hasstatus => true; } }

    Read the article

  • ProgrammingError when aggregating over an annotated & grouped Django ORM query

    - by ento
    I'm trying to construct a query to get the "average, maximum, minimum number of items purchased by a single user". The data source is this simple sales record table: class SalesRecord(models.Model): id = models.IntegerField(primary_key=True) user_id = models.IntegerField() product_code = models.CharField() price = models.IntegerField() created_at = models.DateTimeField() A new record is inserted into this table for every item purchased by a user. Here's my attempt at building the query: q = SalesRecord.objects.all() q = q.values('user_id').annotate( # group by user and count the # of records count=Count('id'), # (= # of items) ).order_by() result = q.aggregate(Max('count'), Min('count'), Avg('count')) When I try to execute the code, a ProgrammingError is raised at the last line: (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM (SELECT sales_records.user_id AS user_id, COUNT(sales_records.`' at line 1") Django's error screen shows that the SQL is SELECT FROM (SELECT `sales_records`.`player_id` AS `player_id`, COUNT(`sales_records`.`id`) AS `count` FROM `sales_records` WHERE (`sales_records`.`created_at` >= %s AND `sales_records`.`created_at` <= %s ) GROUP BY `sales_records`.`player_id` ORDER BY NULL) subquery It's not selecting anything! Can someone please show me the right way to do this? Hacking Django I've found that clearing the cache of selected fields in django.db.models.sql.BaseQuery.get_aggregation() seems to solve the problem. Though I'm not really sure this is a fix or a workaround. @@ -327,10 +327,13 @@ # Remove any aggregates marked for reduction from the subquery # and move them to the outer AggregateQuery. + self._aggregate_select_cache = None + self.aggregate_select_mask = None for alias, aggregate in self.aggregate_select.items(): if aggregate.is_summary: query.aggregate_select[alias] = aggregate - del obj.aggregate_select[alias] + if alias in obj.aggregate_select: + del obj.aggregate_select[alias] ... yields result: {'count__max': 267, 'count__avg': 26.2563, 'count__min': 1}

    Read the article

  • Can I suppress newlines with Django's template engine?

    - by ento
    In Rails ERB, you can suppress newlines by adding a trailing hyphen to tags: <ul> <% for @item in @items -%> <li><%= @item %></li> <% end -%> </ul> becomes: <ul> <li>apple</li> <li>banana</li> <li>cacao</li> </ul> Is there a way to do this in Django? (Disclosure: I'm generating a csv file with Django)

    Read the article

  • Can I suppress newlines after each template tag with Django's template engine?

    - by ento
    In Rails ERB, you can suppress newlines by adding a trailing hyphen to tags: <ul> <% for @item in @items -%> <li><%= @item %></li> <% end -%> </ul> becomes: <ul> <li>apple</li> <li>banana</li> <li>cacao</li> </ul> Is there a way to do this in Django? (Disclosure: I'm generating a csv file with Django) Edit: Clarified that the newlines I'm hunting down are the ones left behind after the template tags.

    Read the article

  • When should I use MySQL compressed protocol?

    - by ento
    I've learned that MySQL can compress communication between servers and clients. Compression is used if both client and server support zlib compression, and the client requests compression. (from MySQL Forge Wiki) The most obvious pros and cons are pros: Reduced payload size cons: Increased computation time So, is compressed protocol something I should enable whenever I can afford servers with adequate specs? Are there other factors I should consider?

    Read the article

1