Exemplo n.º 1
0
    def BeginCases(self, test_file):
        css_urls = ['../../web/base.css', '../../web/spec-tests.css']
        title = '%s: spec test case results' % self.spec_name
        html_head.Write(self.f, title, css_urls=css_urls)

        self.f.write('''\
  <body class="width60">
    <p id="home-link">
      <a href=".">spec test index</a>
      /
      <a href="/">oilshell.org</a>
    </p>
    <h1>Results for %s</h1>
    <table>
    ''' % test_file)
Exemplo n.º 2
0
def main(argv):
  action = argv[1]

  if action == 'index':

    # Bust cache (e.g. Safari iPad seems to cache aggressively and doesn't
    # have Ctrl-F5)
    html_head.Write(sys.stdout, 'Recent Jobs',
        css_urls=['../web/base.css?cache=0', '../web/toil.css?cache=0'])

    print('''
  <body class="width50">
    <p id="home-link">
      <a href="/">travis-ci.oilshell.org</a>
      | <a href="//oilshell.org/">oilshell.org</a>
    </p>

    <h1>Recent Jobs</h1>

    <table>
      <thead>
        <tr>
          <td>Job #</td>
          <td>Job Name</td>
          <td>Start Time</td>
          <td>Elapsed</td>
          <td>Status</td>
          <!--
          <td>Details</td>
          -->
        </tr>
      </thead>
''')

    rows = list(ParseJobs(sys.stdin))

    # Sort by descending build number
    def ByBuildNum(row):
      return int(row.get('TRAVIS_BUILD_NUMBER', 0))

    def ByTaskRunStartTime(row):
      return int(row.get('TASK_RUN_START_TIME', 0))

    rows.sort(key=ByBuildNum, reverse=True)
    groups = itertools.groupby(rows, key=ByBuildNum)
    #print(list(groups))

    for build_num, group in groups:
      build_num = int(build_num)
      log('build %d', build_num)

      jobs = list(group)

      # Sort by start time
      jobs.sort(key=ByTaskRunStartTime, reverse=True)

      # The first job should have the same branch/commit/commit_line
      print(BUILD_ROW_TEMPLATE % jobs[0])

      for job in jobs:
        print(JOB_ROW_TEMPLATE % job)

    print('''\
    </table>

    <p>
      <a href="raw.html">raw data</a>
    </p>
  </body>
</html>
  ''')

  elif action == 'cleanup':
    prefixes = []
    for line in sys.stdin:
      json_path = line.strip()

      log('%s', json_path)
      prefixes.append(json_path[:-5])

    # looks like 2020-03-20, so sort ascending means the oldest are first
    prefixes.sort()

    # Keep 200 jobs.  We only display the last 100.
    prefixes = prefixes[:-200]

    # Show what to delete.  Then the user can pipe to xargs rm to remove it.
    for prefix in prefixes:
      print(prefix + '.json')
      print(prefix + '.tsv')
      print(prefix + '.wwz')

  else:
    raise RuntimeError('Invalid action %r' % action)
Exemplo n.º 3
0
def main(argv):
  action = argv[1]

  if action == 'srht-index':

    # Bust cache (e.g. Safari iPad seems to cache aggressively and doesn't
    # have Ctrl-F5)
    html_head.Write(sys.stdout, 'Recent Jobs',
        css_urls=['../web/base.css?cache=0', '../web/toil.css?cache=0'])

    print(INDEX_TOP)

    rows = list(ParseJobs(sys.stdin))

    # sourcehut doesn't have a build number.  So we use commit date.  BUG: This
    # can be wrong on a VM!
    rows.sort(key=ByCommitDate, reverse=True)
    groups = itertools.groupby(rows, key=ByCommitDate)

    for commit_hash, group in groups:
      jobs = list(group)
      # Sort by start time
      jobs.sort(key=ByTaskRunStartTime, reverse=True)

      # First job
      print(BUILD_ROW_TEMPLATE % jobs[0])

      for job in jobs:
        print(JOB_ROW_TEMPLATE % job)

    print(INDEX_BOTTOM)

  elif action == 'travis-index':

    # Bust cache (e.g. Safari iPad seems to cache aggressively and doesn't
    # have Ctrl-F5)
    html_head.Write(sys.stdout, 'Recent Jobs',
        css_urls=['../web/base.css?cache=0', '../web/toil.css?cache=0'])

    print(INDEX_TOP)
    rows = list(ParseJobs(sys.stdin))

    rows.sort(key=ByBuildNum, reverse=True)
    groups = itertools.groupby(rows, key=ByBuildNum)
    #print(list(groups))

    for build_num, group in groups:
      build_num = int(build_num)
      log('build %d', build_num)

      jobs = list(group)

      # Sort by start time
      jobs.sort(key=ByTaskRunStartTime, reverse=True)

      # The first job should have the same branch/commit/commit_line
      print(BUILD_ROW_TEMPLATE % jobs[0])

      for job in jobs:
        print(JOB_ROW_TEMPLATE % job)

    print(INDEX_BOTTOM)

  elif action == 'cleanup':
    prefixes = []
    for line in sys.stdin:
      json_path = line.strip()

      log('%s', json_path)
      prefixes.append(json_path[:-5])

    # looks like 2020-03-20, so sort ascending means the oldest are first
    prefixes.sort()

    # Keep 200 jobs.  We only display the last 100.
    prefixes = prefixes[:-200]

    # Show what to delete.  Then the user can pipe to xargs rm to remove it.
    for prefix in prefixes:
      print(prefix + '.json')
      print(prefix + '.tsv')
      print(prefix + '.wwz')

  else:
    raise RuntimeError('Invalid action %r' % action)