

"""Run the webpages_playback automation script."""


import os
import sys

from build_step import BuildStep
from utils import shell_utils


class SKPsCapture(BuildStep):
  """BuildStep that captures the buildbot SKPs."""

  def __init__(self, timeout=10800, **kwargs):
    super(SKPsCapture, self).__init__(timeout=timeout, **kwargs)

  def _Run(self):
    webpages_playback_cmd = [
        'python', os.path.join(os.path.dirname(os.path.realpath(__file__)),
                               'webpages_playback.py'),
        '--page_sets', self._args['page_sets'],
        '--skia_tools', self._args['skia_tools'],
        '--browser_executable', self._args['browser_executable'],
        '--non-interactive'
    ]
    if not self._is_try:
      webpages_playback_cmd.append('--upload_to_gs')
    shell_utils.Bash(webpages_playback_cmd)


if '__main__' == __name__:
  sys.exit(BuildStep.RunBuildStep(SKPsCapture))



"""Run the webpages_playback automation script."""


import os
import sys

from build_step import BuildStep
from utils import shell_utils


class SKPsCapture(BuildStep):
  """BuildStep that captures the buildbot SKPs."""

  def __init__(self, timeout=10800, **kwargs):
    super(SKPsCapture, self).__init__(timeout=timeout, **kwargs)

  def _Run(self):
    webpages_playback_cmd = [
      'python', os.path.join(os.path.dirname(os.path.realpath(__file__)),
                             'webpages_playback.py'),
      '--page_sets', self._args['page_sets'],
      '--skia_tools', self._args['skia_tools'],
      '--browser_executable', self._args['browser_executable'],
      '--non-interactive'
    ]
    if not self._is_try:
      webpages_playback_cmd.append('--upload_to_gs')
    shell_utils.Bash(webpages_playback_cmd)

    # Clean up any leftover browser instances. This can happen if there are
    # telemetry crashes, processes are not always cleaned up appropriately by
    # the webpagereplay and telemetry frameworks.
    cleanup_cmd = [
      'pkill', '-9', '-f', self._args['browser_executable']
    ]
    shell_utils.Bash(cleanup_cmd)


if '__main__' == __name__:
  sys.exit(BuildStep.RunBuildStep(SKPsCapture))

Clean up any left over browser processes in the RecreateSKPs buildstep.
Clean up any left over browser processes in the RecreateSKPs buildstep.

BUG=skia:2055
R=borenet@google.com

Review URL: https://codereview.chromium.org/140003003

  
  
  """Run the webpages_playback automation script."""
  
  
  import os
  import sys
  
  from build_step import BuildStep
  from utils import shell_utils
  
  
  class SKPsCapture(BuildStep):
    """BuildStep that captures the buildbot SKPs."""
  
    def __init__(self, timeout=10800, **kwargs):
      super(SKPsCapture, self).__init__(timeout=timeout, **kwargs)
  
    def _Run(self):
      webpages_playback_cmd = [
-         'python', os.path.join(os.path.dirname(os.path.realpath(__file__)),
+       'python', os.path.join(os.path.dirname(os.path.realpath(__file__)),
-                                'webpages_playback.py'),
+                              'webpages_playback.py'),
-         '--page_sets', self._args['page_sets'],
+       '--page_sets', self._args['page_sets'],
-         '--skia_tools', self._args['skia_tools'],
+       '--skia_tools', self._args['skia_tools'],
-         '--browser_executable', self._args['browser_executable'],
+       '--browser_executable', self._args['browser_executable'],
-         '--non-interactive'
+       '--non-interactive'
      ]
      if not self._is_try:
        webpages_playback_cmd.append('--upload_to_gs')
      shell_utils.Bash(webpages_playback_cmd)
  
+     # Clean up any leftover browser instances. This can happen if there are
+     # telemetry crashes, processes are not always cleaned up appropriately by
+     # the webpagereplay and telemetry frameworks.
+     cleanup_cmd = [
+       'pkill', '-9', '-f', self._args['browser_executable']
+     ]
+     shell_utils.Bash(cleanup_cmd)
+ 
  
  if '__main__' == __name__:
    sys.exit(BuildStep.RunBuildStep(SKPsCapture))
  
Clean up any left over browser processes in the RecreateSKPs buildstep.
## Code Before:


"""Run the webpages_playback automation script."""


import os
import sys

from build_step import BuildStep
from utils import shell_utils


class SKPsCapture(BuildStep):
  """BuildStep that captures the buildbot SKPs."""

  def __init__(self, timeout=10800, **kwargs):
    super(SKPsCapture, self).__init__(timeout=timeout, **kwargs)

  def _Run(self):
    webpages_playback_cmd = [
        'python', os.path.join(os.path.dirname(os.path.realpath(__file__)),
                               'webpages_playback.py'),
        '--page_sets', self._args['page_sets'],
        '--skia_tools', self._args['skia_tools'],
        '--browser_executable', self._args['browser_executable'],
        '--non-interactive'
    ]
    if not self._is_try:
      webpages_playback_cmd.append('--upload_to_gs')
    shell_utils.Bash(webpages_playback_cmd)


if '__main__' == __name__:
  sys.exit(BuildStep.RunBuildStep(SKPsCapture))

## Instruction:
Clean up any left over browser processes in the RecreateSKPs buildstep.
## Code After:


"""Run the webpages_playback automation script."""


import os
import sys

from build_step import BuildStep
from utils import shell_utils


class SKPsCapture(BuildStep):
  """BuildStep that captures the buildbot SKPs."""

  def __init__(self, timeout=10800, **kwargs):
    super(SKPsCapture, self).__init__(timeout=timeout, **kwargs)

  def _Run(self):
    webpages_playback_cmd = [
      'python', os.path.join(os.path.dirname(os.path.realpath(__file__)),
                             'webpages_playback.py'),
      '--page_sets', self._args['page_sets'],
      '--skia_tools', self._args['skia_tools'],
      '--browser_executable', self._args['browser_executable'],
      '--non-interactive'
    ]
    if not self._is_try:
      webpages_playback_cmd.append('--upload_to_gs')
    shell_utils.Bash(webpages_playback_cmd)

    # Clean up any leftover browser instances. This can happen if there are
    # telemetry crashes, processes are not always cleaned up appropriately by
    # the webpagereplay and telemetry frameworks.
    cleanup_cmd = [
      'pkill', '-9', '-f', self._args['browser_executable']
    ]
    shell_utils.Bash(cleanup_cmd)


if '__main__' == __name__:
  sys.exit(BuildStep.RunBuildStep(SKPsCapture))
