From a9ff4334a451b1f38273b898c0628fcd2de7b4fa Mon Sep 17 00:00:00 2001 From: Michael L Heuer Date: Mon, 17 Feb 2020 14:49:13 -0600 Subject: [PATCH] Deprecate utils-metrics for removal in version 0.3.0. --- .../utils/instrumentation/ASCIITable.scala | 2 ++ .../utils/instrumentation/Alignment.scala | 1 + .../instrumentation/DurationFormatting.scala | 1 + .../InstrumentationFunctions.scala | 1 + .../utils/instrumentation/Metrics.scala | 3 +++ .../instrumentation/MetricsListener.scala | 1 + .../instrumentation/MetricsRecorder.scala | 1 + .../utils/instrumentation/MonitorTable.scala | 4 ++++ .../instrumentation/RecordedMetrics.scala | 1 + .../utils/instrumentation/ServoTimer.scala | 4 ++++ .../ServoTimersAccumulableParam.scala | 5 ++++ .../utils/instrumentation/SparkMetrics.scala | 5 ++++ .../utils/instrumentation/package.scala | 23 +++++++++++++++++++ .../bdgenomics/utils/metrics/Collection.scala | 1 + .../bdgenomics/utils/metrics/Histogram.scala | 2 ++ .../metrics/aggregators/Aggregator.scala | 9 ++++++++ .../utils/metrics/aggregators/package.scala | 23 +++++++++++++++++++ .../bdgenomics/utils/metrics/package.scala | 23 +++++++++++++++++++ 18 files changed, 110 insertions(+) create mode 100644 utils-metrics/src/main/scala/org/bdgenomics/utils/instrumentation/package.scala create mode 100644 utils-metrics/src/main/scala/org/bdgenomics/utils/metrics/aggregators/package.scala create mode 100644 utils-metrics/src/main/scala/org/bdgenomics/utils/metrics/package.scala diff --git a/utils-metrics/src/main/scala/org/bdgenomics/utils/instrumentation/ASCIITable.scala b/utils-metrics/src/main/scala/org/bdgenomics/utils/instrumentation/ASCIITable.scala index 3db2f22..424102b 100644 --- a/utils-metrics/src/main/scala/org/bdgenomics/utils/instrumentation/ASCIITable.scala +++ b/utils-metrics/src/main/scala/org/bdgenomics/utils/instrumentation/ASCIITable.scala @@ -27,6 +27,7 @@ import org.bdgenomics.utils.instrumentation.Alignment.Alignment * * There must be an equal number of items in each row and in the header. */ +@deprecated("to be removed in version 0.3.0") class ASCIITable(header: Array[ASCIITableHeader], rows: Array[Array[String]]) { rows.foreach(row => { @@ -99,4 +100,5 @@ class ASCIITable(header: Array[ASCIITableHeader], rows: Array[Array[String]]) { } +@deprecated("to be removed in version 0.3.0") case class ASCIITableHeader(name: String, alignment: Alignment = Alignment.Right) diff --git a/utils-metrics/src/main/scala/org/bdgenomics/utils/instrumentation/Alignment.scala b/utils-metrics/src/main/scala/org/bdgenomics/utils/instrumentation/Alignment.scala index 1c124c3..2b46309 100644 --- a/utils-metrics/src/main/scala/org/bdgenomics/utils/instrumentation/Alignment.scala +++ b/utils-metrics/src/main/scala/org/bdgenomics/utils/instrumentation/Alignment.scala @@ -20,6 +20,7 @@ package org.bdgenomics.utils.instrumentation /** * Represents alignment of a cell in a table */ +@deprecated("to be removed in version 0.3.0") object Alignment extends Enumeration { type Alignment = Value val Left, Right, Center = Value diff --git a/utils-metrics/src/main/scala/org/bdgenomics/utils/instrumentation/DurationFormatting.scala b/utils-metrics/src/main/scala/org/bdgenomics/utils/instrumentation/DurationFormatting.scala index 4873247..d5f0329 100644 --- a/utils-metrics/src/main/scala/org/bdgenomics/utils/instrumentation/DurationFormatting.scala +++ b/utils-metrics/src/main/scala/org/bdgenomics/utils/instrumentation/DurationFormatting.scala @@ -27,6 +27,7 @@ import scala.concurrent.duration.Duration * - Durations greater than one minute, but less than one hour are formatted as "X mins X secs" * - Durations less than one minute are formatted with two digits after the decimal point. Zeros are suppressed. */ +@deprecated("to be removed in version 0.3.0") object DurationFormatting { private val TwoDigitNumberFormatter = new DecimalFormat(".0#") diff --git a/utils-metrics/src/main/scala/org/bdgenomics/utils/instrumentation/InstrumentationFunctions.scala b/utils-metrics/src/main/scala/org/bdgenomics/utils/instrumentation/InstrumentationFunctions.scala index 8db333c..3fbb022 100644 --- a/utils-metrics/src/main/scala/org/bdgenomics/utils/instrumentation/InstrumentationFunctions.scala +++ b/utils-metrics/src/main/scala/org/bdgenomics/utils/instrumentation/InstrumentationFunctions.scala @@ -23,6 +23,7 @@ import java.io.PrintWriter /** * Helper functions for instrumentation */ +@deprecated("to be removed in version 0.3.0") object InstrumentationFunctions { def renderTable(name: String, timers: Seq[Monitor[_]], header: Seq[TableHeader]): String = { diff --git a/utils-metrics/src/main/scala/org/bdgenomics/utils/instrumentation/Metrics.scala b/utils-metrics/src/main/scala/org/bdgenomics/utils/instrumentation/Metrics.scala index 354aa39..78dc92a 100644 --- a/utils-metrics/src/main/scala/org/bdgenomics/utils/instrumentation/Metrics.scala +++ b/utils-metrics/src/main/scala/org/bdgenomics/utils/instrumentation/Metrics.scala @@ -51,6 +51,7 @@ import scala.util.DynamicVariable * * To switch-on recording of metrics for a specific thread, the companion [[Metrics]] object must be used. */ +@deprecated("to be removed in version 0.3.0") abstract class Metrics(val clock: Clock = new Clock()) extends Serializable { /** * Creates a timer with the specified name. @@ -72,6 +73,7 @@ abstract class Metrics(val clock: Clock = new Clock()) extends Serializable { * Attempting to record metrics when the initialize method has not been called will not produce an error, and incurs very * little overhead. However, attempting to call the print method to print the metrics will produce an error. */ +@deprecated("to be removed in version 0.3.0") object Metrics { private implicit val accumulableParam = new ServoTimersAccumulableParam() @@ -341,6 +343,7 @@ object Metrics { } +@deprecated("to be removed in version 0.3.0") class Clock extends Serializable { def nanoTime() = System.nanoTime() } diff --git a/utils-metrics/src/main/scala/org/bdgenomics/utils/instrumentation/MetricsListener.scala b/utils-metrics/src/main/scala/org/bdgenomics/utils/instrumentation/MetricsListener.scala index d09ab3c..df7b1d2 100644 --- a/utils-metrics/src/main/scala/org/bdgenomics/utils/instrumentation/MetricsListener.scala +++ b/utils-metrics/src/main/scala/org/bdgenomics/utils/instrumentation/MetricsListener.scala @@ -31,6 +31,7 @@ import scala.concurrent.duration._ * @note This class relies on being run in the same process as the driver. However, * this is the way that Spark seems to work. */ +@deprecated("to be removed in version 0.3.0") class MetricsListener(val metrics: RecordedMetrics) extends SparkListener { private val sparkMetrics = metrics.sparkMetrics diff --git a/utils-metrics/src/main/scala/org/bdgenomics/utils/instrumentation/MetricsRecorder.scala b/utils-metrics/src/main/scala/org/bdgenomics/utils/instrumentation/MetricsRecorder.scala index 74afbf0..8c21deb 100644 --- a/utils-metrics/src/main/scala/org/bdgenomics/utils/instrumentation/MetricsRecorder.scala +++ b/utils-metrics/src/main/scala/org/bdgenomics/utils/instrumentation/MetricsRecorder.scala @@ -29,6 +29,7 @@ import scala.collection.mutable * Note: this class is intended to be used in a thread-local context, and therefore it is not * thread-safe. Do not attempt to call it concurrently from multiple threads! */ +@deprecated("to be removed in version 0.3.0") class MetricsRecorder(val accumulable: Accumulable[ServoTimers, RecordedTiming], existingTimings: Option[Seq[TimingPath]] = None) extends Serializable { diff --git a/utils-metrics/src/main/scala/org/bdgenomics/utils/instrumentation/MonitorTable.scala b/utils-metrics/src/main/scala/org/bdgenomics/utils/instrumentation/MonitorTable.scala index 37cd1f7..0179a10 100644 --- a/utils-metrics/src/main/scala/org/bdgenomics/utils/instrumentation/MonitorTable.scala +++ b/utils-metrics/src/main/scala/org/bdgenomics/utils/instrumentation/MonitorTable.scala @@ -34,6 +34,7 @@ import scala.collection.mutable.ArrayBuffer * - formatFunction (optional): a function which formats the value extracted from the monitor as a [[String]] * - alignment (optional): specifies how the data in a cell is aligned; defaults to right-alignment */ +@deprecated("to be removed in version 0.3.0") class MonitorTable(headerRow: Array[TableHeader], rows: Array[Monitor[_]]) { override def toString: String = { @@ -65,9 +66,11 @@ class MonitorTable(headerRow: Array[TableHeader], rows: Array[Monitor[_]]) { /** * Specifies the title of a column, as well as how data is extracted to form the cells of this column */ +@deprecated("to be removed in version 0.3.0") case class TableHeader(name: String, valueExtractor: ValueExtractor, formatFunction: Option[(Any) => String] = None, alignment: Alignment.Alignment = Alignment.Right) +@deprecated("to be removed in version 0.3.0") object ValueExtractor { /** * Creates a [[ValueExtractor]] which extracts values from [[Monitor]]s matching the specified tag. @@ -93,6 +96,7 @@ object ValueExtractor { } } +@deprecated("to be removed in version 0.3.0") trait ValueExtractor { def extractValue(monitor: Monitor[_]): Option[Any] } diff --git a/utils-metrics/src/main/scala/org/bdgenomics/utils/instrumentation/RecordedMetrics.scala b/utils-metrics/src/main/scala/org/bdgenomics/utils/instrumentation/RecordedMetrics.scala index 323dedb..7603576 100644 --- a/utils-metrics/src/main/scala/org/bdgenomics/utils/instrumentation/RecordedMetrics.scala +++ b/utils-metrics/src/main/scala/org/bdgenomics/utils/instrumentation/RecordedMetrics.scala @@ -20,6 +20,7 @@ package org.bdgenomics.utils.instrumentation /** * Currently this consists only of metrics collected from Spark, but there may be others in the future. */ +@deprecated("to be removed in version 0.3.0") class RecordedMetrics { val sparkMetrics = new RecordedSparkMetrics() diff --git a/utils-metrics/src/main/scala/org/bdgenomics/utils/instrumentation/ServoTimer.scala b/utils-metrics/src/main/scala/org/bdgenomics/utils/instrumentation/ServoTimer.scala index ea9a54c..68e12d9 100644 --- a/utils-metrics/src/main/scala/org/bdgenomics/utils/instrumentation/ServoTimer.scala +++ b/utils-metrics/src/main/scala/org/bdgenomics/utils/instrumentation/ServoTimer.scala @@ -41,6 +41,7 @@ import scala.collection.mutable * @param name the name of this timer; this is propagated to sub-monitors * @param tags the tags for this timer; these are propagated to sub-monitors */ +@deprecated("to be removed in version 0.3.0") class ServoTimer(name: String, @transient tags: Tag*) extends ConfigurableMonitor(name, tags) with CompositeMonitor[Object] { @@ -216,6 +217,7 @@ class ServoTimer(name: String, @transient tags: Tag*) extends ConfigurableMonito } } +@deprecated("to be removed in version 0.3.0") abstract class ConfigurableMonitor(val name: String, @transient tags: Seq[Tag]) extends Taggable with Serializable { @@ -255,6 +257,7 @@ abstract class ConfigurableMonitor(val name: String, @transient tags: Seq[Tag]) private class SerializableTag(val key: String, val value: String) extends Serializable +@deprecated("to be removed in version 0.3.0") object ServoTimer { private final val StatisticTagKey = "statistic" @@ -276,6 +279,7 @@ object ServoTimer { } +@deprecated("to be removed in version 0.3.0") trait Taggable { def addTag(tag: Tag) } diff --git a/utils-metrics/src/main/scala/org/bdgenomics/utils/instrumentation/ServoTimersAccumulableParam.scala b/utils-metrics/src/main/scala/org/bdgenomics/utils/instrumentation/ServoTimersAccumulableParam.scala index 3db7311..659d8d9 100644 --- a/utils-metrics/src/main/scala/org/bdgenomics/utils/instrumentation/ServoTimersAccumulableParam.scala +++ b/utils-metrics/src/main/scala/org/bdgenomics/utils/instrumentation/ServoTimersAccumulableParam.scala @@ -25,6 +25,7 @@ import scala.collection.mutable /** * Implementation of [[AccumulableParam]] that records timings and returns a [[ServoTimers]] with the accumulated timings. */ +@deprecated("to be removed in version 0.3.0") class ServoTimersAccumulableParam extends AccumulableParam[ServoTimers, RecordedTiming] { override def addAccumulator(timers: ServoTimers, newTiming: RecordedTiming): ServoTimers = { timers.recordTiming(newTiming) @@ -46,6 +47,7 @@ class ServoTimersAccumulableParam extends AccumulableParam[ServoTimers, Recorded * specifies all of its ancestors. Timings can be recorded using the `recordTiming` method, which will * either update an existing timer if the specified [[TimingPath]] exists already, or will create a new timer. */ +@deprecated("to be removed in version 0.3.0") class ServoTimers extends Serializable { val timerMap = new ConcurrentHashMap[TimingPath, ServoTimer]() @@ -85,11 +87,13 @@ class ServoTimers extends Serializable { /** * Specifies a timing that is to recorded */ +@deprecated("to be removed in version 0.3.0") case class RecordedTiming(timingNanos: Long, pathToRoot: TimingPath) extends Serializable /** * Specifies a timer name, along with all of its ancestors. */ +@deprecated("to be removed in version 0.3.0") class TimingPath(val timerName: String, val parentPath: Option[TimingPath], val sequenceId: Int = 0, val isRDDOperation: Boolean = false, val shouldRecord: Boolean = true) extends Serializable { @@ -164,6 +168,7 @@ class TimingPath(val timerName: String, val parentPath: Option[TimingPath], val } +@deprecated("to be removed in version 0.3.0") class TimingPathKey(val timerName: String, val sequenceId: Int, val isRDDOperation: Boolean, val shouldRecord: Boolean = true) { private val cachedHashCode = computeHashCode() diff --git a/utils-metrics/src/main/scala/org/bdgenomics/utils/instrumentation/SparkMetrics.scala b/utils-metrics/src/main/scala/org/bdgenomics/utils/instrumentation/SparkMetrics.scala index 89eb233..e7e4167 100644 --- a/utils-metrics/src/main/scala/org/bdgenomics/utils/instrumentation/SparkMetrics.scala +++ b/utils-metrics/src/main/scala/org/bdgenomics/utils/instrumentation/SparkMetrics.scala @@ -31,6 +31,7 @@ import scala.concurrent.duration._ /** * Allows metrics for Spark to be captured and rendered in tabular form. */ +@deprecated("to be removed in version 0.3.0") abstract class SparkMetrics { private val taskTimers = new mutable.ArrayBuffer[TaskTimer]() @@ -131,12 +132,14 @@ abstract class SparkMetrics { } +@deprecated("to be removed in version 0.3.0") protected object SparkMetrics { final val HostTagKey = "host" final val StageNameTagKey = "stageName" final val StageIdTagKey = "stageId" } +@deprecated("to be removed in version 0.3.0") class TaskTimer(name: String) { val overallTimings = buildTimer(name) val timingsByHost = new mutable.HashMap[String, ServoTimer] @@ -168,6 +171,8 @@ class TaskTimer(name: String) { } } +@deprecated("to be removed in version 0.3.0") case class SparkTaskContext(executorId: String, stageId: Int) +@deprecated("to be removed in version 0.3.0") case class StageTiming(stageId: Int, stageName: Option[String], duration: Duration) diff --git a/utils-metrics/src/main/scala/org/bdgenomics/utils/instrumentation/package.scala b/utils-metrics/src/main/scala/org/bdgenomics/utils/instrumentation/package.scala new file mode 100644 index 0000000..d0cf1df --- /dev/null +++ b/utils-metrics/src/main/scala/org/bdgenomics/utils/instrumentation/package.scala @@ -0,0 +1,23 @@ +/** + * Licensed to Big Data Genomics (BDG) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The BDG licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.bdgenomics.utils + +/** + * Deprecated in version 0.2.16, will be removed in version 0.3.0. + */ +package object instrumentation {} diff --git a/utils-metrics/src/main/scala/org/bdgenomics/utils/metrics/Collection.scala b/utils-metrics/src/main/scala/org/bdgenomics/utils/metrics/Collection.scala index d626f2e..53e3cea 100644 --- a/utils-metrics/src/main/scala/org/bdgenomics/utils/metrics/Collection.scala +++ b/utils-metrics/src/main/scala/org/bdgenomics/utils/metrics/Collection.scala @@ -17,6 +17,7 @@ */ package org.bdgenomics.utils.metrics +@deprecated("to be removed in version 0.3.0") class Collection[T](val values: Seq[T]) extends Serializable { } diff --git a/utils-metrics/src/main/scala/org/bdgenomics/utils/metrics/Histogram.scala b/utils-metrics/src/main/scala/org/bdgenomics/utils/metrics/Histogram.scala index 3a602de..ef34241 100644 --- a/utils-metrics/src/main/scala/org/bdgenomics/utils/metrics/Histogram.scala +++ b/utils-metrics/src/main/scala/org/bdgenomics/utils/metrics/Histogram.scala @@ -20,6 +20,7 @@ package org.bdgenomics.utils.metrics import java.io.{ StringWriter, Writer } import org.bdgenomics.utils.metrics.aggregators.Aggregated +@deprecated("to be removed in version 0.3.0") class Histogram[T](val valueToCount: Map[T, Int]) extends Aggregated[T] with Serializable { /** @@ -82,6 +83,7 @@ class Histogram[T](val valueToCount: Map[T, Int]) extends Aggregated[T] with Ser } } +@deprecated("to be removed in version 0.3.0") object Histogram { def apply[T](valueToCount: Map[T, Int]): Histogram[T] = diff --git a/utils-metrics/src/main/scala/org/bdgenomics/utils/metrics/aggregators/Aggregator.scala b/utils-metrics/src/main/scala/org/bdgenomics/utils/metrics/aggregators/Aggregator.scala index 6b2a8b3..1f84e71 100644 --- a/utils-metrics/src/main/scala/org/bdgenomics/utils/metrics/aggregators/Aggregator.scala +++ b/utils-metrics/src/main/scala/org/bdgenomics/utils/metrics/aggregators/Aggregator.scala @@ -20,6 +20,7 @@ package org.bdgenomics.utils.metrics.aggregators import java.io.Writer import org.bdgenomics.utils.metrics.{ Collection, Histogram } +@deprecated("to be removed in version 0.3.0") trait Aggregator[SingleType, AggType <: Aggregated[SingleType]] extends Serializable { /** @@ -46,15 +47,18 @@ trait Aggregator[SingleType, AggType <: Aggregated[SingleType]] extends Serializ } +@deprecated("to be removed in version 0.3.0") trait Writable { def write(stream: Writer) } +@deprecated("to be removed in version 0.3.0") trait Aggregated[+T] extends Writable with Serializable { def count(): Long def countIdentical(): Long } +@deprecated("to be removed in version 0.3.0") class AggregatedCollection[T, U <: Aggregated[T]](val values: Seq[U]) extends Aggregated[Collection[Seq[T]]] with Serializable { @@ -68,10 +72,12 @@ class AggregatedCollection[T, U <: Aggregated[T]](val values: Seq[U]) } } +@deprecated("to be removed in version 0.3.0") object AggregatedCollection { def apply[T, U <: Aggregated[T]](values: Seq[U]) = new AggregatedCollection[T, U](values) } +@deprecated("to be removed in version 0.3.0") class CombinedAggregator[Single, Agg <: Aggregated[Single]](aggs: Seq[Aggregator[Single, Agg]]) extends Aggregator[Collection[Seq[Single]], AggregatedCollection[Single, Agg]] { @@ -96,6 +102,7 @@ class CombinedAggregator[Single, Agg <: Aggregated[Single]](aggs: Seq[Aggregator }) } +@deprecated("to be removed in version 0.3.0") class UniqueAggregator[T] extends Aggregator[T, UniqueWritable[T]] { /** * An initial value for the aggregation @@ -110,6 +117,7 @@ class UniqueAggregator[T] extends Aggregator[T, UniqueWritable[T]] { def combine(first: UniqueWritable[T], second: UniqueWritable[T]): UniqueWritable[T] = first.union(second) } +@deprecated("to be removed in version 0.3.0") class HistogramAggregator[T] extends Aggregator[T, Histogram[T]] { /** * An initial value for the aggregation @@ -125,6 +133,7 @@ class HistogramAggregator[T] extends Aggregator[T, Histogram[T]] { } +@deprecated("to be removed in version 0.3.0") class UniqueWritable[T](vals: T*) extends Aggregated[T] with Serializable { val count = vals.size.toLong diff --git a/utils-metrics/src/main/scala/org/bdgenomics/utils/metrics/aggregators/package.scala b/utils-metrics/src/main/scala/org/bdgenomics/utils/metrics/aggregators/package.scala new file mode 100644 index 0000000..ca1f6e7 --- /dev/null +++ b/utils-metrics/src/main/scala/org/bdgenomics/utils/metrics/aggregators/package.scala @@ -0,0 +1,23 @@ +/** + * Licensed to Big Data Genomics (BDG) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The BDG licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.bdgenomics.utils.metrics + +/** + * Deprecated in version 0.2.16, will be removed in version 0.3.0. + */ +package object aggregators {} diff --git a/utils-metrics/src/main/scala/org/bdgenomics/utils/metrics/package.scala b/utils-metrics/src/main/scala/org/bdgenomics/utils/metrics/package.scala new file mode 100644 index 0000000..5552eb2 --- /dev/null +++ b/utils-metrics/src/main/scala/org/bdgenomics/utils/metrics/package.scala @@ -0,0 +1,23 @@ +/** + * Licensed to Big Data Genomics (BDG) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The BDG licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.bdgenomics.utils + +/** + * Deprecated in version 0.2.16, will be removed in version 0.3.0. + */ +package object metrics {}