コード例 #1
0
ファイル: downloads.py プロジェクト: faizilham/dagasiya
	{
		"filename": the filename
		"server": the server name or full download url (including filename)
		"size": (estimated) file size in bytes
		"known": whether the server is a known server (included in preconfig) or not (thus full url)
		"status": Status enum
		"queuetime": queue timestamp
		"starttime": start timestamp
		"endtime": finished / error timestamp
		"user": proxy account used for downloading
	}
"""

Status = enum(
	QUEUE = 0,
	DOWNLOADING = 1,
	FINISHED = 2,
	ERROR = -1
)

class Downloads(Model):
	def __init__(self, dbpath):
		Model.__init__(self, dbpath, "downloads")
		self.Status = Status

	def insert(self, filename, server, size):
		return self.db.insert({"filename": filename, "server": server, "size": size, "known": True, "status": Status.QUEUE, "queuetime": timestamp()})

	def insertUrl(self, filename, url, size):
		return self.db.insert({"filename": filename, "server": url, "size": size, "known": False, "status": Status.QUEUE, "queuetime": timestamp()})

	def get_queue(self):
コード例 #2
0
EVENT_API_URI = 'https://events.pagerduty.com/generic/2010-04-15/create_event.json'
ALL_PROPERTIES = ['service_key', 'summary', 'description', 'incident_key', 'details']

from models import enum

EventType = enum(TRIGGER='trigger', ACKNOWLEDGE='acknowledge', RESOLVE='resolve')
Properties = enum(SERVICE_KEY='service_key', SUMMARY='summary', DESCRIPTION='description',
                  INCIDENT_KEY='incident_key', DETAILS='details')

REQUIRED_PROPERTIES = [Properties.SERVICE_KEY, Properties.SUMMARY, Properties.DESCRIPTION, Properties.INCIDENT_KEY]
コード例 #3
0
##############################################################################
#
# Copyright (C) Zenoss, Inc. 2018, all rights reserved.
#
# This content is made available according to terms specified in
# License.zenoss under the directory where your Zenoss product is installed.
#
##############################################################################

EVENT_API_URI = 'https://events.pagerduty.com/v2/enqueue'
ALL_PROPERTIES = ['serviceKey', 'summary', 'description', 'incidentKey', 'details']

from models import enum

EventType = enum(TRIGGER='trigger', ACKNOWLEDGE='acknowledge', RESOLVE='resolve')
Properties = enum(SERVICE_KEY='serviceKey', SUMMARY='summary', DESCRIPTION='description',
                  INCIDENT_KEY='incidentKey', DETAILS='details')

REQUIRED_PROPERTIES = [Properties.SERVICE_KEY, Properties.SUMMARY, Properties.DESCRIPTION, Properties.INCIDENT_KEY]