Remove unnecessary logcat_file code.
Bug: 119614469
Test: acloud-dev create --local-image
acloud-dev create
Change-Id: I5c36cfcf625557dca8e2336e8cf7704e5c8d07fc
diff --git a/create/avd_spec.py b/create/avd_spec.py
index 8aaae2e..f632d23 100644
--- a/create/avd_spec.py
+++ b/create/avd_spec.py
@@ -117,7 +117,6 @@
self._cfg = config.GetAcloudConfig(args)
# Reporting args.
self._serial_log_file = None
- self._logcat_file = None
# gpu and emulator_build_id is only used for goldfish avd_type.
self._gpu = None
self._emulator_build_id = None
@@ -269,7 +268,6 @@
constants.INSTANCE_TYPE_REMOTE)
self._num_of_instances = args.num
self._serial_log_file = args.serial_log_file
- self._logcat_file = args.logcat_file
self._emulator_build_id = args.emulator_build_id
self._gpu = args.gpu
@@ -615,11 +613,6 @@
return self._serial_log_file
@property
- def logcat_file(self):
- """Return logcat file path."""
- return self._logcat_file
-
- @property
def gpu(self):
"""Return gpu."""
return self._gpu
diff --git a/create/create_args.py b/create/create_args.py
index f694fb5..87c01ea 100644
--- a/create/create_args.py
+++ b/create/create_args.py
@@ -50,13 +50,6 @@
help="Path to a *tar.gz file where serial logs will be saved "
"when a device fails on boot.")
parser.add_argument(
- "--logcat-file",
- type=str,
- dest="logcat_file",
- required=False,
- help="Path to a *tar.gz file where logcat logs will be saved "
- "when a device fails on boot.")
- parser.add_argument(
"--autoconnect",
action="store_true",
dest="autoconnect",
@@ -193,12 +186,6 @@
required=False,
help=argparse.SUPPRESS)
parser.add_argument(
- "--logcat_file",
- type=str,
- dest="logcat_file",
- required=False,
- help=argparse.SUPPRESS)
- parser.add_argument(
"--build_id",
type=str,
dest="build_id",
diff --git a/public/acloud_main.py b/public/acloud_main.py
index 86229b4..28bdf30 100644
--- a/public/acloud_main.py
+++ b/public/acloud_main.py
@@ -282,10 +282,6 @@
and not parsed_args.serial_log_file.endswith(".tar.gz")):
raise errors.CommandArgError(
"--serial_log_file must ends with .tar.gz")
- if (parsed_args.logcat_file
- and not parsed_args.logcat_file.endswith(".tar.gz")):
- raise errors.CommandArgError(
- "--logcat_file must ends with .tar.gz")
def _SetupLogging(log_file, verbose):
@@ -381,7 +377,6 @@
system_build_target=args.system_build_target,
num=args.num,
serial_log_file=args.serial_log_file,
- logcat_file=args.logcat_file,
autoconnect=args.autoconnect,
report_internal_ip=args.report_internal_ip,
boot_timeout_secs=args.boot_timeout_secs)
@@ -398,7 +393,6 @@
gpu=args.gpu,
num=args.num,
serial_log_file=args.serial_log_file,
- logcat_file=args.logcat_file,
autoconnect=args.autoconnect,
tags=args.tags,
report_internal_ip=args.report_internal_ip)
diff --git a/public/actions/common_operations.py b/public/actions/common_operations.py
index 88f079b..48ff713 100644
--- a/public/actions/common_operations.py
+++ b/public/actions/common_operations.py
@@ -23,7 +23,6 @@
from __future__ import print_function
import logging
import os
-import subprocess
from acloud import errors
from acloud.public import avd
@@ -89,36 +88,6 @@
self._device_factory = device_factory
self._compute_client = device_factory.GetComputeClient()
- def _CollectAdbLogcats(self, output_dir):
- """Collect Adb logcats.
-
- Args:
- output_dir: String, the output file directory to store adb logcats.
-
- Returns:
- The file information dictionary with file path and file name.
- """
- file_dict = {}
- for device in self._devices:
- if not device.adb_port:
- # If device adb tunnel is not established, do not do adb logcat
- continue
- file_name = "%s_adb_logcat.log" % device.instance_name
- full_file_path = os.path.join(output_dir, file_name)
- logger.info("Get adb %s:%s logcat for instance %s",
- constants.LOCALHOST, device.adb_port,
- device.instance_name)
- try:
- subprocess.check_call(
- ["adb -s %s:%s logcat -b all -d > %s" % (
- constants.LOCALHOST, device.adb_port, full_file_path)],
- shell=True)
- file_dict[full_file_path] = file_name
- except subprocess.CalledProcessError:
- logging.error("Failed to get adb logcat for %s for instance %s",
- device.serial_number, device.instance_name)
- return file_dict
-
def CreateDevices(self, num):
"""Creates |num| devices for given build_target and build_id.
@@ -155,38 +124,6 @@
failures[device.instance_name] = e
return failures
- def PullLogs(self, source_files, output_dir, user=None, ssh_rsa_path=None):
- """Tar logs from GCE instance into output_dir.
-
- Args:
- source_files: List of file names to be pulled.
- output_dir: String. The output file dirtory
- user: String, the ssh username to access GCE
- ssh_rsa_path: String, the ssh rsa key path to access GCE
-
- Returns:
- The file dictionary with file_path and file_name
- """
-
- file_dict = {}
- for device in self._devices:
- if isinstance(source_files, basestring):
- source_files = [source_files]
- for source_file in source_files:
- file_name = "%s_%s" % (device.instance_name,
- os.path.basename(source_file))
- dst_file = os.path.join(output_dir, file_name)
- logger.info("Pull %s for instance %s with user %s to %s",
- source_file, device.instance_name, user, dst_file)
- try:
- utils.ScpPullFile(source_file, dst_file, device.ip,
- user_name=user, rsa_key_file=ssh_rsa_path)
- file_dict[dst_file] = file_name
- except errors.DeviceConnectionError as e:
- logger.warning("Failed to pull %s from instance %s: %s",
- source_file, device.instance_name, e)
- return file_dict
-
def CollectSerialPortLogs(self, output_file,
port=constants.DEFAULT_SERIAL_PORT):
"""Tar the instance serial logs into specified output_file.
@@ -211,26 +148,6 @@
f.write(serial_log.encode("utf-8"))
utils.MakeTarFile(src_dict, output_file)
- def CollectLogcats(self, output_file, ssh_user, ssh_rsa_path):
- """Tar the instances' logcat and other logs into specified output_file.
-
- Args:
- output_file: String, the output tar file path
- ssh_user: The ssh user name
- ssh_rsa_path: The ssh rsa key path
- """
- with utils.TempDir() as tempdir:
- file_dict = {}
- if getattr(self._device_factory, "LOG_FILES", None):
- file_dict = self.PullLogs(
- self._device_factory.LOG_FILES, tempdir, user=ssh_user,
- ssh_rsa_path=ssh_rsa_path)
- # If the device is auto-connected, get adb logcat
- for file_path, file_name in self._CollectAdbLogcats(
- tempdir).items():
- file_dict[file_path] = file_name
- utils.MakeTarFile(file_dict, output_file)
-
def SetDeviceBuildInfo(self):
"""Add devices build info."""
for device in self._devices:
@@ -245,14 +162,12 @@
"""
return self._devices
-# TODO: Delete unused-argument when b/119614469 is resolved.
# pylint: disable=unused-argument
# pylint: disable=too-many-locals
def CreateDevices(command, cfg, device_factory, num, avd_type,
report_internal_ip=False, autoconnect=False,
- serial_log_file=None, logcat_file=None,
- client_adb_port=None, boot_timeout_secs=None,
- unlock_screen=False):
+ serial_log_file=None, client_adb_port=None,
+ boot_timeout_secs=None, unlock_screen=False):
"""Create a set of devices using the given factory.
Main jobs in create devices.
@@ -268,7 +183,6 @@
report_internal_ip: Boolean to report the internal ip instead of
external ip.
serial_log_file: String, the file path to tar the serial logs.
- logcat_file: String, the file path to tar the logcats.
autoconnect: Boolean, whether to auto connect to device.
client_adb_port: Integer, Specify port for adb forwarding.
boot_timeout_secs: Integer, boot timeout secs.
@@ -296,10 +210,6 @@
if serial_log_file:
device_pool.CollectSerialPortLogs(
serial_log_file, port=constants.DEFAULT_SERIAL_PORT)
- # TODO(b/119614469): Refactor CollectLogcats into a utils lib and
- # turn it on inside the reporting loop.
- # if logcat_file:
- # device_pool.CollectLogcats(logcat_file, ssh_user, ssh_rsa_path)
# Write result to report.
for device in device_pool.devices:
diff --git a/public/actions/create_cuttlefish_action.py b/public/actions/create_cuttlefish_action.py
index 7b9df33..6839168 100644
--- a/public/actions/create_cuttlefish_action.py
+++ b/public/actions/create_cuttlefish_action.py
@@ -174,7 +174,6 @@
system_build_target=None,
num=1,
serial_log_file=None,
- logcat_file=None,
autoconnect=False,
report_internal_ip=False,
boot_timeout_secs=None):
@@ -195,7 +194,6 @@
num: Integer, Number of devices to create.
serial_log_file: String, A path to a tar file where serial output should
be saved to.
- logcat_file: String, A path to a file where logcat logs should be saved.
autoconnect: Boolean, Create ssh tunnel(s) and adb connect after device creation.
report_internal_ip: Boolean to report the internal ip instead of
external ip.
@@ -215,7 +213,6 @@
autoconnect = avd_spec.autoconnect
report_internal_ip = avd_spec.report_internal_ip
serial_log_file = avd_spec.serial_log_file
- logcat_file = avd_spec.logcat_file
client_adb_port = avd_spec.client_adb_port
boot_timeout_secs = avd_spec.boot_timeout_secs
kernel_branch = avd_spec.kernel_build_info[constants.BUILD_BRANCH]
@@ -238,12 +235,11 @@
"system_build_target: %s, "
"num: %s, "
"serial_log_file: %s, "
- "logcat_file: %s, "
"autoconnect: %s, "
"report_internal_ip: %s", cfg.project, build_target,
build_id, branch, kernel_build_id, kernel_branch, kernel_build_target,
system_branch, system_build_id, system_build_target, num,
- serial_log_file, logcat_file, autoconnect, report_internal_ip)
+ serial_log_file, autoconnect, report_internal_ip)
device_factory = CuttlefishDeviceFactory(
cfg, build_target, build_id, branch=branch, avd_spec=avd_spec,
kernel_build_id=kernel_build_id, kernel_branch=kernel_branch,
@@ -253,6 +249,5 @@
return common_operations.CreateDevices("create_cf", cfg, device_factory,
num, constants.TYPE_CF,
report_internal_ip, autoconnect,
- serial_log_file, logcat_file,
- client_adb_port, boot_timeout_secs,
- unlock_screen)
+ serial_log_file, client_adb_port,
+ boot_timeout_secs, unlock_screen)
diff --git a/public/actions/create_goldfish_action.py b/public/actions/create_goldfish_action.py
index fa569d9..36124f8 100644
--- a/public/actions/create_goldfish_action.py
+++ b/public/actions/create_goldfish_action.py
@@ -235,7 +235,6 @@
gpu=None,
num=1,
serial_log_file=None,
- logcat_file=None,
autoconnect=False,
branch=None,
tags=None,
@@ -256,7 +255,6 @@
num: Integer, Number of devices to create.
serial_log_file: String, A path to a file where serial output should
be saved to.
- logcat_file: String, A path to a file where logcat logs should be saved.
autoconnect: Boolean, Create ssh tunnel(s) and adb connect after device
creation.
branch: String, Branch name for system image.
@@ -279,7 +277,6 @@
emulator_build_id = avd_spec.emulator_build_id
gpu = avd_spec.gpu
serial_log_file = avd_spec.serial_log_file
- logcat_file = avd_spec.logcat_file
autoconnect = avd_spec.autoconnect
report_internal_ip = avd_spec.report_internal_ip
client_adb_port = avd_spec.client_adb_port
@@ -317,10 +314,10 @@
"Creating a goldfish device in project %s, build_target: %s, "
"build_id: %s, emulator_bid: %s, kernel_build_id: %s, "
"kernel_branh: %s, GPU: %s, num: %s, "
- "serial_log_file: %s, logcat_file: %s, "
+ "serial_log_file: %s, "
"autoconnect: %s", cfg.project, build_target, build_id,
emulator_build_id, kernel_build_id, kernel_branch, gpu, num,
- serial_log_file, logcat_file, autoconnect)
+ serial_log_file, autoconnect)
device_factory = GoldfishDeviceFactory(cfg, build_target, build_id,
cfg.emulator_build_target,
@@ -334,5 +331,5 @@
return common_operations.CreateDevices("create_gf", cfg, device_factory,
num, constants.TYPE_GF,
report_internal_ip, autoconnect,
- serial_log_file, logcat_file,
- client_adb_port, boot_timeout_secs)
+ serial_log_file, client_adb_port,
+ boot_timeout_secs)
diff --git a/public/device_driver.py b/public/device_driver.py
index 09f57fe..a18dcc7 100755
--- a/public/device_driver.py
+++ b/public/device_driver.py
@@ -347,7 +347,6 @@
local_disk_image=None,
cleanup=True,
serial_log_file=None,
- logcat_file=None,
autoconnect=False,
report_internal_ip=False,
avd_spec=None):
@@ -367,7 +366,6 @@
disk image in storage after creating the instance.
serial_log_file: A path to a file where serial output should
be saved to.
- logcat_file: A path to a file where logcat logs should be saved.
autoconnect: Create ssh tunnel(s) and adb connect after device creation.
report_internal_ip: Boolean to report the internal ip instead of
external ip.
@@ -427,19 +425,13 @@
else:
r.SetStatus(report.Status.SUCCESS)
- # Dump serial and logcat logs.
+ # Dump serial logs.
if serial_log_file:
_FetchSerialLogsFromDevices(
compute_client,
instance_names=[d.instance_name for d in device_pool.devices],
port=constants.DEFAULT_SERIAL_PORT,
output_file=serial_log_file)
- if logcat_file:
- _FetchSerialLogsFromDevices(
- compute_client,
- instance_names=[d.instance_name for d in device_pool.devices],
- port=constants.LOGCAT_SERIAL_PORT,
- output_file=logcat_file)
except errors.DriverError as e:
r.AddError(str(e))
r.SetStatus(report.Status.FAIL)