-
Notifications
You must be signed in to change notification settings - Fork 28.9k
[SPARK-26640][CORE][ML][SQL][STREAMING][PYSPARK] Code cleanup from lgtm.com analysis #23571
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -114,7 +114,6 @@ $(document).ready(function () { | |
|
|
||
| var endPoint = createRESTEndPointForExecutorsPage(appId); | ||
| $.getJSON(endPoint, function (response, status, jqXHR) { | ||
| var summary = []; | ||
| var allExecCnt = 0; | ||
| var allRDDBlocks = 0; | ||
| var allMemoryUsed = 0; | ||
|
|
@@ -505,7 +504,7 @@ $(document).ready(function () { | |
| {data: 'allTotalTasks'}, | ||
| { | ||
| data: function (row, type) { | ||
| return type === 'display' ? (formatDuration(row.allTotalDuration, type) + ' (' + formatDuration(row.allTotalGCTime, type) + ')') : row.allTotalDuration | ||
| return type === 'display' ? (formatDuration(row.allTotalDuration) + ' (' + formatDuration(row.allTotalGCTime) + ')') : row.allTotalDuration | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unused JS function args |
||
| }, | ||
| "fnCreatedCell": function (nTd, sData, oData, iRow, iCol) { | ||
| if (oData.allTotalDuration > 0) { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -103,20 +103,20 @@ $(document).ready(function() { | |
| pageLength: 20 | ||
| }); | ||
|
|
||
| historySummary = $("#history-summary"); | ||
| searchString = historySummary["context"]["location"]["search"]; | ||
| requestedIncomplete = getParameterByName("showIncomplete", searchString); | ||
| var historySummary = $("#history-summary"); | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Implicit var -> explicit |
||
| var searchString = historySummary["context"]["location"]["search"]; | ||
| var requestedIncomplete = getParameterByName("showIncomplete", searchString); | ||
| requestedIncomplete = (requestedIncomplete == "true" ? true : false); | ||
|
|
||
| appParams = { | ||
| var appParams = { | ||
| limit: appLimit, | ||
| status: (requestedIncomplete ? "running" : "completed") | ||
| }; | ||
|
|
||
| $.getJSON(uiRoot + "/api/v1/applications", appParams, function(response,status,jqXHR) { | ||
| var array = []; | ||
| var hasMultipleAttempts = false; | ||
| for (i in response) { | ||
| for (var i in response) { | ||
| var app = response[i]; | ||
| if (app["attempts"][0]["completed"] == requestedIncomplete) { | ||
| continue; // if we want to show for Incomplete, we skip the completed apps; otherwise skip incomplete ones. | ||
|
|
@@ -127,7 +127,7 @@ $(document).ready(function() { | |
| hasMultipleAttempts = true; | ||
| } | ||
| var num = app["attempts"].length; | ||
| for (j in app["attempts"]) { | ||
| for (var j in app["attempts"]) { | ||
| var attempt = app["attempts"][j]; | ||
| attempt["startTime"] = formatTimeMillis(attempt["startTimeEpoch"]); | ||
| attempt["endTime"] = formatTimeMillis(attempt["endTimeEpoch"]); | ||
|
|
@@ -149,15 +149,15 @@ $(document).ready(function() { | |
| "applications": array, | ||
| "hasMultipleAttempts": hasMultipleAttempts, | ||
| "showCompletedColumns": !requestedIncomplete, | ||
| } | ||
| }; | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Implicit semicolon -> explicit |
||
|
|
||
| $.get(uiRoot + "/static/historypage-template.html", function(template) { | ||
| var sibling = historySummary.prev(); | ||
| historySummary.detach(); | ||
| var apps = $(Mustache.render($(template).filter("#history-summary-template").html(),data)); | ||
| var attemptIdColumnName = 'attemptId'; | ||
| var startedColumnName = 'started'; | ||
| var defaultSortColumn = completedColumnName = 'completed'; | ||
| var completedColumnName = 'completed'; | ||
| var durationColumnName = 'duration'; | ||
| var conf = { | ||
| "columns": [ | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,7 +18,6 @@ | |
| from __future__ import print_function | ||
|
|
||
| from pyspark.sql import SparkSession | ||
| from pyspark.ml.param import Params | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unused imports |
||
| from pyspark.mllib.linalg import * | ||
| import sys | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -29,7 +29,7 @@ | |
|
|
||
| from sparktestsupport import SPARK_HOME, USER_HOME, ERROR_CODES | ||
| from sparktestsupport.shellutils import exit_from_command_with_retcode, run_cmd, rm_r, which | ||
| from sparktestsupport.toposort import toposort_flatten, toposort | ||
| from sparktestsupport.toposort import toposort_flatten | ||
| import sparktestsupport.modules as modules | ||
|
|
||
|
|
||
|
|
@@ -153,30 +153,6 @@ def determine_java_executable(): | |
| return java_exe if java_exe else which("java") | ||
|
|
||
|
|
||
| JavaVersion = namedtuple('JavaVersion', ['major', 'minor', 'patch']) | ||
|
|
||
|
|
||
| def determine_java_version(java_exe): | ||
| """Given a valid java executable will return its version in named tuple format | ||
| with accessors '.major', '.minor', '.patch', '.update'""" | ||
|
|
||
| raw_output = subprocess.check_output([java_exe, "-version"], | ||
| stderr=subprocess.STDOUT, | ||
| universal_newlines=True) | ||
|
|
||
| raw_output_lines = raw_output.split('\n') | ||
|
|
||
| # find raw version string, eg 'java version "1.8.0_25"' | ||
| raw_version_str = next(x for x in raw_output_lines if " version " in x) | ||
|
|
||
| match = re.search(r'(\d+)\.(\d+)\.(\d+)', raw_version_str) | ||
|
|
||
| major = int(match.group(1)) | ||
| minor = int(match.group(2)) | ||
| patch = int(match.group(3)) | ||
|
|
||
| return JavaVersion(major, minor, patch) | ||
|
|
||
| # ------------------------------------------------------------------------------------------------- | ||
| # Functions for running the other build and test scripts | ||
| # ------------------------------------------------------------------------------------------------- | ||
|
|
@@ -443,7 +419,6 @@ def run_python_packaging_tests(): | |
| def run_build_tests(): | ||
| set_title_and_block("Running build tests", "BLOCK_BUILD_TESTS") | ||
| run_cmd([os.path.join(SPARK_HOME, "dev", "test-dependencies.sh")]) | ||
| pass | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
|
||
|
|
||
| def run_sparkr_tests(): | ||
|
|
@@ -495,8 +470,6 @@ def main(): | |
| " install one and retry.") | ||
| sys.exit(2) | ||
|
|
||
| java_version = determine_java_version(java_exe) | ||
|
|
||
| # install SparkR | ||
| if which("R"): | ||
| run_cmd([os.path.join(SPARK_HOME, "R", "install-dev.sh")]) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -45,9 +45,9 @@ | |
| metrics = MulticlassMetrics(predictionAndLabels) | ||
|
|
||
| # Overall statistics | ||
| precision = metrics.precision() | ||
| recall = metrics.recall() | ||
| f1Score = metrics.fMeasure() | ||
| precision = metrics.precision(1.0) | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missed this when removing deprecated no-arg method |
||
| recall = metrics.recall(1.0) | ||
| f1Score = metrics.fMeasure(1.0) | ||
| print("Summary Stats") | ||
| print("Precision = %s" % precision) | ||
| print("Recall = %s" % recall) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -455,6 +455,7 @@ protected boolean handle(String opt, String value) { | |
| conf.put(SparkLauncher.DRIVER_EXTRA_CLASSPATH, value); | ||
| break; | ||
| case CONF: | ||
| checkArgument(value != null, "Missing argument to %s", CONF); | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Flags that this seems like it wants to check for null as it's check elsewhere |
||
| String[] setConf = value.split("=", 2); | ||
| checkArgument(setConf.length == 2, "Invalid argument to %s: %s", CONF, value); | ||
| conf.put(setConf[0], setConf[1]); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,7 +18,6 @@ | |
| import atexit | ||
| import os | ||
| import sys | ||
| import select | ||
| import signal | ||
| import shlex | ||
| import shutil | ||
|
|
@@ -174,8 +173,7 @@ def local_connect_and_auth(port, auth_secret): | |
| errors.append("tried to connect to %s, but an error occured: %s" % (sa, emsg)) | ||
| sock.close() | ||
| sock = None | ||
| else: | ||
| raise Exception("could not open socket: %s" % errors) | ||
| raise Exception("could not open socket: %s" % errors) | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
|
||
|
|
||
| def ensure_callback_server_started(gw): | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unused variables