소스 검색

EarwigBot moved to Labs; rm some tools that aren't happening soon.

pull/24/head
Ben Kurtovic 11 년 전
부모
커밋
d408395e37
5개의 변경된 파일0개의 추가작업 그리고 71개의 파일을 삭제
  1. +0
    -13
      pages/earwigbot.mako
  2. +0
    -6
      pages/index.mako
  3. +0
    -4
      pages/surveyor.mako
  4. +0
    -4
      pages/swmt.mako
  5. +0
    -44
      toolserver/eb_inter.py

+ 0
- 13
pages/earwigbot.mako 파일 보기

@@ -1,13 +0,0 @@
<%include file="/support/header.mako" args="environ=environ, cookies=cookies, title='EarwigBot Status'"/>\
<%namespace module="toolserver.eb_inter" import="collect_status_info"/>\
<%def name="get_status()" filter="trim">
<% status, since, uptime, host = collect_status_info() %>
${"has been" if status == "online" else "is"} <span class="${status}">${status}</span>
% if status == "online":
since ${since} (${uptime} uptime) on <tt>${host}</tt>
% endif
</%def>\
<h1>EarwigBot Status</h1>
<p>EarwigBot ${get_status()}.</p>
<p>Additional information: <a href="http://status.toolserver.org/">status.toolserver.org</a></p>
<%include file="/support/footer.mako" args="environ=environ, cookies=cookies"/>

+ 0
- 6
pages/index.mako 파일 보기

@@ -7,12 +7,6 @@
("DIVIDER"),
("Copyvio Detector", "copyvios", "copyvios", True,
'Try to detect <a href="//en.wikipedia.org/wiki/WP:COPYVIO">copyright violations</a> in articles by searching the web for page content, or compare an article to a specific URL.'),
("EarwigBot Status", "earwigbot", "earwigbot", True,
'View <a href="//en.wikipedia.org/wiki/User:EarwigBot">EarwigBot</a>\'s current status and read its IRC-based mini-wiki.'),
("Contribution Surveyor", "surveyor", "surveyor", False,
"Nothing to see here yet!"),
("SWMT Helper", "swmt", "swmt", False,
"Nothing to see here yet!"),
]
%>\
<%


+ 0
- 4
pages/surveyor.mako 파일 보기

@@ -1,4 +0,0 @@
<%include file="/support/header.mako" args="environ=environ, cookies=cookies, title='Contribution Surveyor'"/>
<h1>Contribution Surveyor</h1>
<p>This tool does not exist yet. Watch this space for updates.</p>
<%include file="/support/footer.mako" args="environ=environ, cookies=cookies"/>

+ 0
- 4
pages/swmt.mako 파일 보기

@@ -1,4 +0,0 @@
<%include file="/support/header.mako" args="environ=environ, cookies=cookies, title='SWMT Helper'"/>
<h1>SWMT Helper</h1>
<p>This tool does not exist yet. Watch this space for updates.</p>
<%include file="/support/footer.mako" args="environ=environ, cookies=cookies"/>

+ 0
- 44
toolserver/eb_inter.py 파일 보기

@@ -1,44 +0,0 @@
from datetime import datetime
import os
import re
from shlex import split
from subprocess import check_output, CalledProcessError, STDOUT

os.environ["SGE_ROOT"] = "/sge/GE"

def collect_status_info(context):
try:
result = str(check_output(split("qstat -j earwigbot"), stderr=STDOUT))
except CalledProcessError:
return ["offline", None, None, None]

if result.startswith("Following jobs do not exist:"):
return ["offline", None, None, None]

lines = result.splitlines()[1:]
data = {}
for line in lines:
re_key = re.match(r"(.*?):\s", line)
re_val = re.search(r":\s*(.*?)$", line)
if re_key and re_val:
data[re_key.group(1)] = re_val
since, uptime = _format_date(data["submission_time"])
host = data["sge_o_host"]
return ["online", since, uptime, host]

def _format_date(time):
start = datetime.strptime(time, "%a %b %d %H:%M:%S %Y")
since = start.strftime("%b %d, %Y %H:%M:%S UTC")
diff = (datetime.utcnow() - start)
if diff.days:
uptime = "{0} days".format(diff.days)
if diff.seconds >= 3600:
uptime += ", {0} hours".format(diff.seconds / 3600)
else:
if diff.seconds > 3600:
uptime = "{0} hours".format(diff.seconds / 3600)
elif diff.seconds > 60:
uptime = "{0} minutes".format(diff.seconds / 60)
else:
uptime = "{0} seconds".format(diff.seconds)
return (since, uptime)

불러오는 중...
취소
저장