Skip to content
This repository has been archived by the owner on Nov 9, 2020. It is now read-only.

Commit

Permalink
Add --status option to filter job list by job status
Browse files Browse the repository at this point in the history
The --status option allows the users to only list jobs with a specific status (options: open, quoted, accepted, rejected, running, or delivered).
  • Loading branch information
VidalQuevedo committed Mar 1, 2014
1 parent b34bc31 commit 52da4e3
Showing 1 changed file with 24 additions and 17 deletions.
41 changes: 24 additions & 17 deletions src/list_jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,35 @@ class ListJobs(GnipHistoricalCmd):
def setOptions(self, parser):
parser.add_option("-d", "--since-date", dest="sinceDateString", default=None,
help="Only list jobs after date, (default 2012-01-01T00:00:00)")
parser.add_option("-s", "--status", dest="statusString", default=None,
help="Only list jobs with a specific status (options: open, quoted, accepted, rejected, running, or delivered")


# available statuses: rejected, accepted, running, quoted
def output(self, status):
if self.options.verbose:
status = self.gnipHistorical.getJobStatus(status.jobURL)
print str(status)
if status.result is not None:
status.result.write()
if self.options.statusString is not None and status.status != self.options.statusString:
return
else:
print "#"*25
print "TITLE: ",status.title
print "STATUS: ",status.status
print "PROGRESS: ",status.percentComplete,"%"
print "JOB URL: ",status.jobURL
if self.options.prevUrl or self.options.url is not None:
if self.options.verbose:
status = self.gnipHistorical.getJobStatus(status.jobURL)
print str(status)
if status.result is not None:
print
print str(status.quote)
print str(status.result)
print "Writing files to data_files.txt..."
status.result.write()
elif status.status.lower().startswith("delivered"):
print 'Data files available, use "-v, -u or -l" flag to download files list.'
else:
print "#"*25
print "TITLE: ",status.title
print "STATUS: ",status.status
print "PROGRESS: ",status.percentComplete,"%"
print "JOB URL: ",status.jobURL
if self.options.prevUrl or self.options.url is not None:
if status.result is not None:
print
print str(status.quote)
print str(status.result)
print "Writing files to data_files.txt..."
status.result.write()
elif status.status.lower().startswith("delivered"):
print 'Data files available, use "-v, -u or -l" flag to download files list.'

def __call__(self):
if self.userUrl is None:
Expand Down

0 comments on commit 52da4e3

Please sign in to comment.