コード例 #1
0
 def handle(self, *args, **options):
     twitter_filters = TwitterFilter.objects.filter(is_active=True)
     if options.get('twitterfilter', None):
         twitter_filters = twitter_filters.filter(
             id=options.get('twitterfilter'))
     for tf in twitter_filters:
         create_conf_file(tf.id)
コード例 #2
0
def call_create_conf(sender, instance, **kwargs):
    if instance.is_active is True:
        create_conf_file(instance.id)
        time.sleep(1)
        ui.utils.reload_config()
        ui.utils.add_process_group(instance.id)
    else:
        ui.utils.remove_process_group(instance.id)
        delete_conf_file(instance.id)
コード例 #3
0
ファイル: models.py プロジェクト: kayiwa/social-feed-manager
def call_create_conf(sender, instance, **kwargs):
    # Remove and (in the case of an active filter) re-add
    # the supervisor process group.  Otherwise the configuration
    # file updates are ignored by supervisor.
    #
    # TODO: Consider not just swallowing the condition
    # where Supervisor isn't running
    if os.path.exists(settings.SUPERVISOR_UNIX_SOCKET_FILE):
        ui.utils.remove_process_group(instance.id)
        if instance.is_active is True:
            create_conf_file(instance.id)
            time.sleep(1)
            ui.utils.reload_config()
            ui.utils.add_process_group(instance.id)
        else:
            delete_conf_file(instance.id)