[flink-jira-bot] branch master updated (dcb4a44 -> b95a7a0)

2021-05-19 Thread knaufk
This is an automated email from the ASF dual-hosted git repository.

knaufk pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/flink-jira-bot.git.


from dcb4a44  Merge pull request #15 from knaufk/FLINK-22569
 new db7888a  [hotfix] add missing parameter in docstring
 new 748b2dd  [hotfix] fix signature of handle_stale_ticket
 new 1631057  [hotfix] remove unused code
 new b95a7a0  Merge pull request #16 from knaufk/hotfix-signature

The 51 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 flink_jira_rule.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)


[flink] branch release-1.13 updated: [FLINK-22699][table-common] Declare ConstantArgumentCount as @PublicEvolving

2021-05-19 Thread twalthr
This is an automated email from the ASF dual-hosted git repository.

twalthr pushed a commit to branch release-1.13
in repository https://gitbox.apache.org/repos/asf/flink.git


The following commit(s) were added to refs/heads/release-1.13 by this push:
 new ac19f76  [FLINK-22699][table-common] Declare ConstantArgumentCount as 
@PublicEvolving
ac19f76 is described below

commit ac19f763b97e07486a1ad498d72a6409e8352d27
Author: Timo Walther 
AuthorDate: Wed May 19 17:26:31 2021 +0200

[FLINK-22699][table-common] Declare ConstantArgumentCount as @PublicEvolving
---
 .../java/org/apache/flink/table/types/inference/ArgumentCount.java| 2 ++
 .../org/apache/flink/table/types/inference/ConstantArgumentCount.java | 4 ++--
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git 
a/flink-table/flink-table-common/src/main/java/org/apache/flink/table/types/inference/ArgumentCount.java
 
b/flink-table/flink-table-common/src/main/java/org/apache/flink/table/types/inference/ArgumentCount.java
index 7aa92fe..43946340 100644
--- 
a/flink-table/flink-table-common/src/main/java/org/apache/flink/table/types/inference/ArgumentCount.java
+++ 
b/flink-table/flink-table-common/src/main/java/org/apache/flink/table/types/inference/ArgumentCount.java
@@ -27,6 +27,8 @@ import java.util.Optional;
  *
  * Note: Implementations should implement {@link Object#hashCode()} and 
{@link
  * Object#equals(Object)}.
+ *
+ * @see ConstantArgumentCount
  */
 @PublicEvolving
 public interface ArgumentCount {
diff --git 
a/flink-table/flink-table-common/src/main/java/org/apache/flink/table/types/inference/ConstantArgumentCount.java
 
b/flink-table/flink-table-common/src/main/java/org/apache/flink/table/types/inference/ConstantArgumentCount.java
index c7fcb18..4409023 100644
--- 
a/flink-table/flink-table-common/src/main/java/org/apache/flink/table/types/inference/ConstantArgumentCount.java
+++ 
b/flink-table/flink-table-common/src/main/java/org/apache/flink/table/types/inference/ConstantArgumentCount.java
@@ -18,7 +18,7 @@
 
 package org.apache.flink.table.types.inference;
 
-import org.apache.flink.annotation.Internal;
+import org.apache.flink.annotation.PublicEvolving;
 import org.apache.flink.util.Preconditions;
 
 import java.util.Objects;
@@ -29,7 +29,7 @@ import java.util.Optional;
  *
  * Note: All boundaries of this class are inclusive. All indices are 
0-based.
  */
-@Internal
+@PublicEvolving
 public final class ConstantArgumentCount implements ArgumentCount {
 
 private static final int OPEN_INTERVAL = -1;


[flink] branch master updated (938680c -> 3c732c7)

2021-05-19 Thread twalthr
This is an automated email from the ASF dual-hosted git repository.

twalthr pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/flink.git.


from 938680c  [hotfix][docs] Update SQL grammar for WITH and sub queries
 add 3c732c7  [FLINK-22699][table-common] Declare ConstantArgumentCount as 
@PublicEvolving

No new revisions were added by this update.

Summary of changes:
 .../java/org/apache/flink/table/types/inference/ArgumentCount.java| 2 ++
 .../org/apache/flink/table/types/inference/ConstantArgumentCount.java | 4 ++--
 2 files changed, 4 insertions(+), 2 deletions(-)


[flink] branch release-1.13 updated: [hotfix][docs] Update SQL grammar for WITH and sub queries

2021-05-19 Thread twalthr
This is an automated email from the ASF dual-hosted git repository.

twalthr pushed a commit to branch release-1.13
in repository https://gitbox.apache.org/repos/asf/flink.git


The following commit(s) were added to refs/heads/release-1.13 by this push:
 new d7c5f89  [hotfix][docs] Update SQL grammar for WITH and sub queries
d7c5f89 is described below

commit d7c5f89a857e0b204e774fb7f3917f2782045d4e
Author: Timo Walther 
AuthorDate: Wed May 19 14:25:27 2021 +0200

[hotfix][docs] Update SQL grammar for WITH and sub queries
---
 .../docs/dev/table/sql/queries/overview.md | 116 +++--
 .../content/docs/dev/table/sql/queries/overview.md | 116 +++--
 2 files changed, 122 insertions(+), 110 deletions(-)

diff --git a/docs/content.zh/docs/dev/table/sql/queries/overview.md 
b/docs/content.zh/docs/dev/table/sql/queries/overview.md
index 6cc22ea..649adcd 100644
--- a/docs/content.zh/docs/dev/table/sql/queries/overview.md
+++ b/docs/content.zh/docs/dev/table/sql/queries/overview.md
@@ -246,9 +246,10 @@ The following BNF-grammar describes the superset of 
supported SQL features in ba
 {{< expand Grammar >}}
 ```sql
 query:
-  values
+values
+  | WITH withItem [ , withItem ]* query
   | {
-  select
+select
   | selectWithoutFrom
   | query UNION [ ALL ] query
   | query EXCEPT query
@@ -259,64 +260,70 @@ query:
 [ OFFSET start { ROW | ROWS } ]
 [ FETCH { FIRST | NEXT } [ count ] { ROW | ROWS } ONLY]
 
+withItem:
+name
+[ '(' column [, column ]* ')' ]
+AS '(' query ')'
+
 orderItem:
-  expression [ ASC | DESC ]
+expression [ ASC | DESC ]
 
 select:
-  SELECT [ ALL | DISTINCT ]
-  { * | projectItem [, projectItem ]* }
-  FROM tableExpression
-  [ WHERE booleanExpression ]
-  [ GROUP BY { groupItem [, groupItem ]* } ]
-  [ HAVING booleanExpression ]
-  [ WINDOW windowName AS windowSpec [, windowName AS windowSpec ]* ]
+SELECT [ ALL | DISTINCT ]
+{ * | projectItem [, projectItem ]* }
+FROM tableExpression
+[ WHERE booleanExpression ]
+[ GROUP BY { groupItem [, groupItem ]* } ]
+[ HAVING booleanExpression ]
+[ WINDOW windowName AS windowSpec [, windowName AS windowSpec ]* ]
 
 selectWithoutFrom:
-  SELECT [ ALL | DISTINCT ]
-  { * | projectItem [, projectItem ]* }
+SELECT [ ALL | DISTINCT ]
+{ * | projectItem [, projectItem ]* }
 
 projectItem:
-  expression [ [ AS ] columnAlias ]
+expression [ [ AS ] columnAlias ]
   | tableAlias . *
 
 tableExpression:
-  tableReference [, tableReference ]*
+tableReference [, tableReference ]*
   | tableExpression [ NATURAL ] [ LEFT | RIGHT | FULL ] JOIN tableExpression [ 
joinCondition ]
 
 joinCondition:
-  ON booleanExpression
+ON booleanExpression
   | USING '(' column [, column ]* ')'
 
 tableReference:
-  tablePrimary
-  [ matchRecognize ]
-  [ [ AS ] alias [ '(' columnAlias [, columnAlias ]* ')' ] ]
+tablePrimary
+[ matchRecognize ]
+[ [ AS ] alias [ '(' columnAlias [, columnAlias ]* ')' ] ]
 
 tablePrimary:
-  [ TABLE ] tablePath [ dynamicTableOptions ] [systemTimePeriod] [[AS] 
correlationName]
+[ TABLE ] tablePath [ dynamicTableOptions ] [systemTimePeriod] [[AS] 
correlationName]
   | LATERAL TABLE '(' functionName '(' expression [, expression ]* ')' ')'
+  | [ LATERAL ] '(' query ')'
   | UNNEST '(' expression ')'
 
 tablePath:
-  [ [ catalogName . ] schemaName . ] tableName
+[ [ catalogName . ] databaseName . ] tableName
 
 systemTimePeriod:
-  FOR SYSTEM_TIME AS OF dateTimeExpression
+FOR SYSTEM_TIME AS OF dateTimeExpression
 
 dynamicTableOptions:
-  /*+ OPTIONS(key=val [, key=val]*) */
+/*+ OPTIONS(key=val [, key=val]*) */
 
 key:
-  stringLiteral
+stringLiteral
 
 val:
-  stringLiteral
+stringLiteral
 
 values:
-  VALUES expression [, expression ]*
+VALUES expression [, expression ]*
 
 groupItem:
-  expression
+expression
   | '(' ')'
   | '(' expression [, expression ]* ')'
   | CUBE '(' expression [, expression ]* ')'
@@ -339,45 +346,44 @@ windowSpec:
 ')'
 
 matchRecognize:
-  MATCH_RECOGNIZE '('
-  [ PARTITION BY expression [, expression ]* ]
-  [ ORDER BY orderItem [, orderItem ]* ]
-  [ MEASURES measureColumn [, measureColumn ]* ]
-  [ ONE ROW PER MATCH ]
-  [ AFTER MATCH
-( SKIP TO NEXT ROW
-| SKIP PAST LAST ROW
-| SKIP TO FIRST variable
-| SKIP TO LAST variable
-| SKIP TO variable )
-  ]
-  PATTERN '(' pattern ')'
-  [ WITHIN intervalLiteral ]
-  DEFINE variable AS condition [, variable AS condition ]*
-  ')'
+MATCH_RECOGNIZE '('
+[ PARTITION BY expression [, expression ]* ]
+[ ORDER BY orderItem [, orderItem ]* ]
+[ MEASURES measureColumn [, measureColumn ]* ]
+[ ONE ROW PER MATCH ]
+[ AFTER MATCH
+  ( SKIP TO NEXT ROW
+  | SKIP PAST LAST ROW
+  | SKIP TO FIRST variable
+  | SKIP TO LAST variable
+  | SKIP TO variable )
+

[flink] branch master updated (a3b4a08 -> 938680c)

2021-05-19 Thread twalthr
This is an automated email from the ASF dual-hosted git repository.

twalthr pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/flink.git.


from a3b4a08  [FLINK-22487][python] Support `print` to print logs in PyFlink
 add bcf8bd7  [FLINK-22697][examples-table] Update StreamSQLExample to 
current API
 add 54ba156  [FLINK-22697][examples-table] Remove TPCHQuery3Table example
 add 217d703  [FLINK-22697][examples-table] Update WordCountSQLExample to 
current API
 add 25d1aeb  [FLINK-22697][examples-table] Remove WordCountTable example
 add 1310e78  [FLINK-22697][examples-table] Update flink-examples-table 
pom.xml
 add 938680c  [hotfix][docs] Update SQL grammar for WITH and sub queries

No new revisions were added by this update.

Summary of changes:
 .../docs/dev/table/sql/queries/overview.md | 116 ++---
 .../content/docs/dev/table/sql/queries/overview.md | 116 ++---
 flink-examples/flink-examples-table/pom.xml|  92 +--
 .../examples/java/basics/StreamSQLExample.java |  78 -
 .../table/examples/java/basics/WordCountSQL.java   |  84 --
 .../examples/java/basics/WordCountSQLExample.java  |  48 ++
 .../table/examples/java/basics/WordCountTable.java |  81 --
 .../examples/scala/basics/StreamSQLExample.scala   |  75 -
 .../examples/scala/basics/TPCHQuery3Table.scala| 180 -
 .../table/examples/scala/basics/WordCountSQL.scala |  62 ---
 .../scala/basics/WordCountSQLExample.scala |  48 ++
 .../examples/scala/basics/WordCountTable.scala |  62 ---
 ...mpleITCase.java => StreamSQLExampleITCase.java} |  12 +-
 ...eITCase.java => WordCountSQLExampleITCase.java} |  11 +-
 ...mpleITCase.java => StreamSQLExampleITCase.java} |  12 +-
 ...eITCase.java => WordCountSQLExampleITCase.java} |  11 +-
 16 files changed, 315 insertions(+), 773 deletions(-)
 delete mode 100644 
flink-examples/flink-examples-table/src/main/java/org/apache/flink/table/examples/java/basics/WordCountSQL.java
 create mode 100644 
flink-examples/flink-examples-table/src/main/java/org/apache/flink/table/examples/java/basics/WordCountSQLExample.java
 delete mode 100644 
flink-examples/flink-examples-table/src/main/java/org/apache/flink/table/examples/java/basics/WordCountTable.java
 delete mode 100644 
flink-examples/flink-examples-table/src/main/scala/org/apache/flink/table/examples/scala/basics/TPCHQuery3Table.scala
 delete mode 100644 
flink-examples/flink-examples-table/src/main/scala/org/apache/flink/table/examples/scala/basics/WordCountSQL.scala
 create mode 100644 
flink-examples/flink-examples-table/src/main/scala/org/apache/flink/table/examples/scala/basics/WordCountSQLExample.scala
 delete mode 100644 
flink-examples/flink-examples-table/src/main/scala/org/apache/flink/table/examples/scala/basics/WordCountTable.scala
 copy 
flink-examples/flink-examples-table/src/test/java/org/apache/flink/table/examples/java/basics/{GettingStartedExampleITCase.java
 => StreamSQLExampleITCase.java} (72%)
 copy 
flink-examples/flink-examples-table/src/test/java/org/apache/flink/table/examples/java/basics/{GettingStartedExampleITCase.java
 => WordCountSQLExampleITCase.java} (79%)
 copy 
flink-examples/flink-examples-table/src/test/java/org/apache/flink/table/examples/scala/basics/{GettingStartedExampleITCase.java
 => StreamSQLExampleITCase.java} (75%)
 copy 
flink-examples/flink-examples-table/src/test/java/org/apache/flink/table/examples/scala/basics/{GettingStartedExampleITCase.java
 => WordCountSQLExampleITCase.java} (79%)


[flink] 02/02: [FLINK-21329][tests] Increase timeout and delay in local test_local_recovery_and_scheduling.sh

2021-05-19 Thread roman
This is an automated email from the ASF dual-hosted git repository.

roman pushed a commit to branch release-1.12
in repository https://gitbox.apache.org/repos/asf/flink.git

commit e09c919103a19b97abd169732e44ef7231fab1be
Author: Roman Khachatryan 
AuthorDate: Thu Apr 15 13:05:21 2021 +0200

[FLINK-21329][tests] Increase timeout and delay in local 
test_local_recovery_and_scheduling.sh

Back-pressure is likely to occur without injection delay at the source
which may lead to delaying checkpoint triggering at the sources
which may lead to a timeout.

To prevent this, test timeout is increased from 10m to 15m
and injection delay of 100ms is added.
---
 flink-end-to-end-tests/run-nightly-tests.sh  | 12 ++--
 .../test-scripts/test_local_recovery_and_scheduling.sh   |  8 +---
 2 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/flink-end-to-end-tests/run-nightly-tests.sh 
b/flink-end-to-end-tests/run-nightly-tests.sh
index 3bb4ec4..4a00628 100755
--- a/flink-end-to-end-tests/run-nightly-tests.sh
+++ b/flink-end-to-end-tests/run-nightly-tests.sh
@@ -236,12 +236,12 @@ fi
 # Sticky Scheduling
 

 
-run_test "Local recovery and sticky scheduling end-to-end test" 
"$END_TO_END_DIR/test-scripts/test_local_recovery_and_scheduling.sh 4 3 file 
false false" "skip_check_exceptions"
-run_test "Local recovery and sticky scheduling end-to-end test" 
"$END_TO_END_DIR/test-scripts/test_local_recovery_and_scheduling.sh 4 3 file 
false true" "skip_check_exceptions"
-run_test "Local recovery and sticky scheduling end-to-end test" 
"$END_TO_END_DIR/test-scripts/test_local_recovery_and_scheduling.sh 4 10 rocks 
false false" "skip_check_exceptions"
-run_test "Local recovery and sticky scheduling end-to-end test" 
"$END_TO_END_DIR/test-scripts/test_local_recovery_and_scheduling.sh 4 10 rocks 
true false" "skip_check_exceptions"
-run_test "Local recovery and sticky scheduling end-to-end test" 
"$END_TO_END_DIR/test-scripts/test_local_recovery_and_scheduling.sh 4 10 rocks 
false true" "skip_check_exceptions"
-run_test "Local recovery and sticky scheduling end-to-end test" 
"$END_TO_END_DIR/test-scripts/test_local_recovery_and_scheduling.sh 4 10 rocks 
true true" "skip_check_exceptions"
+run_test "Local recovery and sticky scheduling end-to-end test" 
"$END_TO_END_DIR/test-scripts/test_local_recovery_and_scheduling.sh 4 3 file 
false false 100" "skip_check_exceptions"
+run_test "Local recovery and sticky scheduling end-to-end test" 
"$END_TO_END_DIR/test-scripts/test_local_recovery_and_scheduling.sh 4 3 file 
false true 100" "skip_check_exceptions"
+run_test "Local recovery and sticky scheduling end-to-end test" 
"$END_TO_END_DIR/test-scripts/test_local_recovery_and_scheduling.sh 4 10 rocks 
false false 100" "skip_check_exceptions"
+run_test "Local recovery and sticky scheduling end-to-end test" 
"$END_TO_END_DIR/test-scripts/test_local_recovery_and_scheduling.sh 4 10 rocks 
true false 100" "skip_check_exceptions"
+run_test "Local recovery and sticky scheduling end-to-end test" 
"$END_TO_END_DIR/test-scripts/test_local_recovery_and_scheduling.sh 4 10 rocks 
false true 100" "skip_check_exceptions"
+run_test "Local recovery and sticky scheduling end-to-end test" 
"$END_TO_END_DIR/test-scripts/test_local_recovery_and_scheduling.sh 4 10 rocks 
true true 100" "skip_check_exceptions"
 
 printf "\n[PASS] All bash e2e-tests passed\n"
 
diff --git 
a/flink-end-to-end-tests/test-scripts/test_local_recovery_and_scheduling.sh 
b/flink-end-to-end-tests/test-scripts/test_local_recovery_and_scheduling.sh
index 233e62e..5b192dd 100755
--- a/flink-end-to-end-tests/test-scripts/test_local_recovery_and_scheduling.sh
+++ b/flink-end-to-end-tests/test-scripts/test_local_recovery_and_scheduling.sh
@@ -60,13 +60,15 @@ function run_local_recovery_test {
 local backend=$3
 local incremental=$4
 local kill_jvm=$5
+local delay=$6
 
 echo "Running local recovery test with configuration:
 parallelism: ${parallelism}
 max attempts: ${max_attempts}
 backend: ${backend}
 incremental checkpoints: ${incremental}
-kill JVM: ${kill_jvm}"
+kill JVM: ${kill_jvm}
+delay: ${delay}ms"
 
 
TEST_PROGRAM_JAR=${END_TO_END_DIR}/flink-local-recovery-and-allocation-test/target/StickyAllocationAndLocalRecoveryTestJob.jar
 # configure for HA
@@ -97,11 +99,11 @@ function run_local_recovery_test {
 --checkpointDir file://$TEST_DATA_DIR/local_recovery_test/checkpoints \
 --output $TEST_DATA_DIR/out/local_recovery_test/out --killJvmOnFail 
${kill_jvm} --checkpointInterval 1000 \
 --maxAttempts ${max_attempts} --parallelism ${parallelism} --stateBackend 
${backend} \
---incrementalCheckpoints ${incremental}
+--incrementalCheckpoints ${incremental} --delay ${delay}
 
 check_logs ${parallelism} ${max_attempts}
 

[flink] 01/02: [hotfix][runtime] Log checkpoint processing delay if above threshold

2021-05-19 Thread roman
This is an automated email from the ASF dual-hosted git repository.

roman pushed a commit to branch release-1.12
in repository https://gitbox.apache.org/repos/asf/flink.git

commit 7e6fb13d8bded83fa5d3c4b19d5b388cd2418010
Author: Roman Khachatryan 
AuthorDate: Thu Apr 15 12:58:14 2021 +0200

[hotfix][runtime] Log checkpoint processing delay if above threshold
---
 .../runtime/checkpoint/CheckpointMetaData.java  | 21 +++--
 .../org/apache/flink/runtime/taskmanager/Task.java  |  3 ++-
 .../runtime/io/CheckpointBarrierHandler.java|  5 -
 .../runtime/tasks/SourceOperatorStreamTask.java |  2 +-
 .../streaming/runtime/tasks/SourceStreamTask.java   |  2 +-
 .../tasks/SubtaskCheckpointCoordinatorImpl.java | 13 +
 6 files changed, 40 insertions(+), 6 deletions(-)

diff --git 
a/flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/CheckpointMetaData.java
 
b/flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/CheckpointMetaData.java
index 25540ba..1d8e15e 100644
--- 
a/flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/CheckpointMetaData.java
+++ 
b/flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/CheckpointMetaData.java
@@ -28,12 +28,20 @@ public class CheckpointMetaData implements Serializable {
 /** The ID of the checkpoint. */
 private final long checkpointId;
 
-/** The timestamp of the checkpoint. */
+/** The timestamp of the checkpoint triggering. */
 private final long timestamp;
 
+/** The timestamp of the checkpoint receiving by this subtask. */
+private final long receiveTimestamp;
+
 public CheckpointMetaData(long checkpointId, long timestamp) {
+this(checkpointId, timestamp, System.currentTimeMillis());
+}
+
+public CheckpointMetaData(long checkpointId, long timestamp, long 
receiveTimestamp) {
 this.checkpointId = checkpointId;
 this.timestamp = timestamp;
+this.receiveTimestamp = receiveTimestamp;
 }
 
 public long getCheckpointId() {
@@ -44,6 +52,10 @@ public class CheckpointMetaData implements Serializable {
 return timestamp;
 }
 
+public long getReceiveTimestamp() {
+return receiveTimestamp;
+}
+
 @Override
 public boolean equals(Object o) {
 if (this == o) {
@@ -55,13 +67,16 @@ public class CheckpointMetaData implements Serializable {
 
 CheckpointMetaData that = (CheckpointMetaData) o;
 
-return (checkpointId == that.checkpointId) && (timestamp == 
that.timestamp);
+return (checkpointId == that.checkpointId)
+&& (timestamp == that.timestamp)
+&& (receiveTimestamp == that.receiveTimestamp);
 }
 
 @Override
 public int hashCode() {
 int result = (int) (checkpointId ^ (checkpointId >>> 32));
 result = 31 * result + (int) (timestamp ^ (timestamp >>> 32));
+result = 31 * result + (int) (receiveTimestamp ^ (receiveTimestamp >>> 
32));
 return result;
 }
 
@@ -70,6 +85,8 @@ public class CheckpointMetaData implements Serializable {
 return "CheckpointMetaData{"
 + "checkpointId="
 + checkpointId
++ ", receiveTimestamp="
++ receiveTimestamp
 + ", timestamp="
 + timestamp
 + '}';
diff --git 
a/flink-runtime/src/main/java/org/apache/flink/runtime/taskmanager/Task.java 
b/flink-runtime/src/main/java/org/apache/flink/runtime/taskmanager/Task.java
index 288dd4a..3001018 100644
--- a/flink-runtime/src/main/java/org/apache/flink/runtime/taskmanager/Task.java
+++ b/flink-runtime/src/main/java/org/apache/flink/runtime/taskmanager/Task.java
@@ -1258,7 +1258,8 @@ public class Task
 
 final AbstractInvokable invokable = this.invokable;
 final CheckpointMetaData checkpointMetaData =
-new CheckpointMetaData(checkpointID, checkpointTimestamp);
+new CheckpointMetaData(
+checkpointID, checkpointTimestamp, 
System.currentTimeMillis());
 
 if (executionState == ExecutionState.RUNNING && invokable != null) {
 try {
diff --git 
a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/io/CheckpointBarrierHandler.java
 
b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/io/CheckpointBarrierHandler.java
index 132fd78..72cef441 100644
--- 
a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/io/CheckpointBarrierHandler.java
+++ 
b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/io/CheckpointBarrierHandler.java
@@ -104,7 +104,10 @@ public abstract class CheckpointBarrierHandler implements 
Closeable {
 
 protected void notifyCheckpoint(CheckpointBarrier checkpointBarrier) 
throws IOException {
 CheckpointMetaData checkpointMetaData =
-new CheckpointMetaData(checkpointBarrier.getId(), 

[flink] branch release-1.12 updated (a153976 -> e09c919)

2021-05-19 Thread roman
This is an automated email from the ASF dual-hosted git repository.

roman pushed a change to branch release-1.12
in repository https://gitbox.apache.org/repos/asf/flink.git.


from a153976  [FLINK-22502][checkpointing] Don't tolerate checkpoint 
retrieval failures on recovery
 new 7e6fb13  [hotfix][runtime] Log checkpoint processing delay if above 
threshold
 new e09c919  [FLINK-21329][tests] Increase timeout and delay in local 
test_local_recovery_and_scheduling.sh

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 flink-end-to-end-tests/run-nightly-tests.sh | 12 ++--
 .../test_local_recovery_and_scheduling.sh   |  8 +---
 .../runtime/checkpoint/CheckpointMetaData.java  | 21 +++--
 .../org/apache/flink/runtime/taskmanager/Task.java  |  3 ++-
 .../runtime/io/CheckpointBarrierHandler.java|  5 -
 .../runtime/tasks/SourceOperatorStreamTask.java |  2 +-
 .../streaming/runtime/tasks/SourceStreamTask.java   |  2 +-
 .../tasks/SubtaskCheckpointCoordinatorImpl.java | 13 +
 8 files changed, 51 insertions(+), 15 deletions(-)


[flink] 02/02: [FLINK-21329][tests] Increase timeout and delay in local test_local_recovery_and_scheduling.sh

2021-05-19 Thread roman
This is an automated email from the ASF dual-hosted git repository.

roman pushed a commit to branch release-1.13
in repository https://gitbox.apache.org/repos/asf/flink.git

commit 2f1e7928258876970ac9859e7afe070c9f03fa96
Author: Roman Khachatryan 
AuthorDate: Thu Apr 15 13:05:21 2021 +0200

[FLINK-21329][tests] Increase timeout and delay in local 
test_local_recovery_and_scheduling.sh

Back-pressure is likely to occur without injection delay at the source
which may lead to delaying checkpoint triggering at the sources
which may lead to a timeout.

To prevent this, test timeout is increased from 10m to 15m
and injection delay of 100ms is added.
---
 flink-end-to-end-tests/run-nightly-tests.sh  | 12 ++--
 .../test-scripts/test_local_recovery_and_scheduling.sh   |  8 +---
 2 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/flink-end-to-end-tests/run-nightly-tests.sh 
b/flink-end-to-end-tests/run-nightly-tests.sh
index 7156962..ef8b0a8 100755
--- a/flink-end-to-end-tests/run-nightly-tests.sh
+++ b/flink-end-to-end-tests/run-nightly-tests.sh
@@ -245,12 +245,12 @@ fi
 

 
 if [[ ${PROFILE} != *"enable-adaptive-scheduler"* ]]; then #FLINK-21450
-   run_test "Local recovery and sticky scheduling end-to-end test" 
"$END_TO_END_DIR/test-scripts/test_local_recovery_and_scheduling.sh 4 3 hashmap 
false false" "skip_check_exceptions"
-   run_test "Local recovery and sticky scheduling end-to-end test" 
"$END_TO_END_DIR/test-scripts/test_local_recovery_and_scheduling.sh 4 3 hashmap 
false true" "skip_check_exceptions"
-   run_test "Local recovery and sticky scheduling end-to-end test" 
"$END_TO_END_DIR/test-scripts/test_local_recovery_and_scheduling.sh 4 10 rocks 
false false" "skip_check_exceptions"
-   run_test "Local recovery and sticky scheduling end-to-end test" 
"$END_TO_END_DIR/test-scripts/test_local_recovery_and_scheduling.sh 4 10 rocks 
true false" "skip_check_exceptions"
-   run_test "Local recovery and sticky scheduling end-to-end test" 
"$END_TO_END_DIR/test-scripts/test_local_recovery_and_scheduling.sh 4 10 rocks 
false true" "skip_check_exceptions"
-   run_test "Local recovery and sticky scheduling end-to-end test" 
"$END_TO_END_DIR/test-scripts/test_local_recovery_and_scheduling.sh 4 10 rocks 
true true" "skip_check_exceptions"
+   run_test "Local recovery and sticky scheduling end-to-end test" 
"$END_TO_END_DIR/test-scripts/test_local_recovery_and_scheduling.sh 4 3 hashmap 
false false 100" "skip_check_exceptions"
+   run_test "Local recovery and sticky scheduling end-to-end test" 
"$END_TO_END_DIR/test-scripts/test_local_recovery_and_scheduling.sh 4 3 hashmap 
false true 100" "skip_check_exceptions"
+   run_test "Local recovery and sticky scheduling end-to-end test" 
"$END_TO_END_DIR/test-scripts/test_local_recovery_and_scheduling.sh 4 10 rocks 
false false 100" "skip_check_exceptions"
+   run_test "Local recovery and sticky scheduling end-to-end test" 
"$END_TO_END_DIR/test-scripts/test_local_recovery_and_scheduling.sh 4 10 rocks 
true false 100" "skip_check_exceptions"
+   run_test "Local recovery and sticky scheduling end-to-end test" 
"$END_TO_END_DIR/test-scripts/test_local_recovery_and_scheduling.sh 4 10 rocks 
false true 100" "skip_check_exceptions"
+   run_test "Local recovery and sticky scheduling end-to-end test" 
"$END_TO_END_DIR/test-scripts/test_local_recovery_and_scheduling.sh 4 10 rocks 
true true 100" "skip_check_exceptions"
 fi
 
 printf "\n[PASS] All bash e2e-tests passed\n"
diff --git 
a/flink-end-to-end-tests/test-scripts/test_local_recovery_and_scheduling.sh 
b/flink-end-to-end-tests/test-scripts/test_local_recovery_and_scheduling.sh
index dbd55dc..0d38beb 100755
--- a/flink-end-to-end-tests/test-scripts/test_local_recovery_and_scheduling.sh
+++ b/flink-end-to-end-tests/test-scripts/test_local_recovery_and_scheduling.sh
@@ -60,13 +60,15 @@ function run_local_recovery_test {
 local backend=$3
 local incremental=$4
 local kill_jvm=$5
+local delay=$6
 
 echo "Running local recovery test with configuration:
 parallelism: ${parallelism}
 max attempts: ${max_attempts}
 backend: ${backend}
 incremental checkpoints: ${incremental}
-kill JVM: ${kill_jvm}"
+kill JVM: ${kill_jvm}
+delay: ${delay}ms"
 
 
TEST_PROGRAM_JAR=${END_TO_END_DIR}/flink-local-recovery-and-allocation-test/target/StickyAllocationAndLocalRecoveryTestJob.jar
 # configure for HA
@@ -97,11 +99,11 @@ function run_local_recovery_test {
 --checkpointDir file://$TEST_DATA_DIR/local_recovery_test/checkpoints \
 --output $TEST_DATA_DIR/out/local_recovery_test/out --killJvmOnFail 
${kill_jvm} --checkpointInterval 1000 \
 --maxAttempts ${max_attempts} --parallelism ${parallelism} --stateBackend 
${backend} \
-

[flink] 01/02: [hotfix][runtime] Log checkpoint processing delay if above threshold

2021-05-19 Thread roman
This is an automated email from the ASF dual-hosted git repository.

roman pushed a commit to branch release-1.13
in repository https://gitbox.apache.org/repos/asf/flink.git

commit e624d210b33ca69352f77b16d48acda5494a612a
Author: Roman Khachatryan 
AuthorDate: Thu Apr 15 12:58:14 2021 +0200

[hotfix][runtime] Log checkpoint processing delay if above threshold
---
 .../runtime/checkpoint/CheckpointMetaData.java  | 21 +++--
 .../org/apache/flink/runtime/taskmanager/Task.java  |  3 ++-
 .../io/checkpointing/CheckpointBarrierHandler.java  |  5 -
 .../runtime/tasks/SourceOperatorStreamTask.java |  2 +-
 .../streaming/runtime/tasks/SourceStreamTask.java   |  2 +-
 .../tasks/SubtaskCheckpointCoordinatorImpl.java | 13 +
 6 files changed, 40 insertions(+), 6 deletions(-)

diff --git 
a/flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/CheckpointMetaData.java
 
b/flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/CheckpointMetaData.java
index 25540ba..1d8e15e 100644
--- 
a/flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/CheckpointMetaData.java
+++ 
b/flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/CheckpointMetaData.java
@@ -28,12 +28,20 @@ public class CheckpointMetaData implements Serializable {
 /** The ID of the checkpoint. */
 private final long checkpointId;
 
-/** The timestamp of the checkpoint. */
+/** The timestamp of the checkpoint triggering. */
 private final long timestamp;
 
+/** The timestamp of the checkpoint receiving by this subtask. */
+private final long receiveTimestamp;
+
 public CheckpointMetaData(long checkpointId, long timestamp) {
+this(checkpointId, timestamp, System.currentTimeMillis());
+}
+
+public CheckpointMetaData(long checkpointId, long timestamp, long 
receiveTimestamp) {
 this.checkpointId = checkpointId;
 this.timestamp = timestamp;
+this.receiveTimestamp = receiveTimestamp;
 }
 
 public long getCheckpointId() {
@@ -44,6 +52,10 @@ public class CheckpointMetaData implements Serializable {
 return timestamp;
 }
 
+public long getReceiveTimestamp() {
+return receiveTimestamp;
+}
+
 @Override
 public boolean equals(Object o) {
 if (this == o) {
@@ -55,13 +67,16 @@ public class CheckpointMetaData implements Serializable {
 
 CheckpointMetaData that = (CheckpointMetaData) o;
 
-return (checkpointId == that.checkpointId) && (timestamp == 
that.timestamp);
+return (checkpointId == that.checkpointId)
+&& (timestamp == that.timestamp)
+&& (receiveTimestamp == that.receiveTimestamp);
 }
 
 @Override
 public int hashCode() {
 int result = (int) (checkpointId ^ (checkpointId >>> 32));
 result = 31 * result + (int) (timestamp ^ (timestamp >>> 32));
+result = 31 * result + (int) (receiveTimestamp ^ (receiveTimestamp >>> 
32));
 return result;
 }
 
@@ -70,6 +85,8 @@ public class CheckpointMetaData implements Serializable {
 return "CheckpointMetaData{"
 + "checkpointId="
 + checkpointId
++ ", receiveTimestamp="
++ receiveTimestamp
 + ", timestamp="
 + timestamp
 + '}';
diff --git 
a/flink-runtime/src/main/java/org/apache/flink/runtime/taskmanager/Task.java 
b/flink-runtime/src/main/java/org/apache/flink/runtime/taskmanager/Task.java
index ce22e9e..1643a19 100644
--- a/flink-runtime/src/main/java/org/apache/flink/runtime/taskmanager/Task.java
+++ b/flink-runtime/src/main/java/org/apache/flink/runtime/taskmanager/Task.java
@@ -1292,7 +1292,8 @@ public class Task
 
 final AbstractInvokable invokable = this.invokable;
 final CheckpointMetaData checkpointMetaData =
-new CheckpointMetaData(checkpointID, checkpointTimestamp);
+new CheckpointMetaData(
+checkpointID, checkpointTimestamp, 
System.currentTimeMillis());
 
 if (executionState == ExecutionState.RUNNING && invokable != null) {
 try {
diff --git 
a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/io/checkpointing/CheckpointBarrierHandler.java
 
b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/io/checkpointing/CheckpointBarrierHandler.java
index bfd0b4a..319fa44 100644
--- 
a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/io/checkpointing/CheckpointBarrierHandler.java
+++ 
b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/io/checkpointing/CheckpointBarrierHandler.java
@@ -108,7 +108,10 @@ public abstract class CheckpointBarrierHandler implements 
Closeable {
 
 protected void notifyCheckpoint(CheckpointBarrier checkpointBarrier) 
throws IOException {
 CheckpointMetaData checkpointMetaData =
-

[flink] branch release-1.13 updated (1c7adac -> 2f1e792)

2021-05-19 Thread roman
This is an automated email from the ASF dual-hosted git repository.

roman pushed a change to branch release-1.13
in repository https://gitbox.apache.org/repos/asf/flink.git.


from 1c7adac  [FLINK-19545][e2e] Add e2e test for native Kubernetes HA
 new e624d21  [hotfix][runtime] Log checkpoint processing delay if above 
threshold
 new 2f1e792  [FLINK-21329][tests] Increase timeout and delay in local 
test_local_recovery_and_scheduling.sh

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 flink-end-to-end-tests/run-nightly-tests.sh | 12 ++--
 .../test_local_recovery_and_scheduling.sh   |  8 +---
 .../runtime/checkpoint/CheckpointMetaData.java  | 21 +++--
 .../org/apache/flink/runtime/taskmanager/Task.java  |  3 ++-
 .../io/checkpointing/CheckpointBarrierHandler.java  |  5 -
 .../runtime/tasks/SourceOperatorStreamTask.java |  2 +-
 .../streaming/runtime/tasks/SourceStreamTask.java   |  2 +-
 .../tasks/SubtaskCheckpointCoordinatorImpl.java | 13 +
 8 files changed, 51 insertions(+), 15 deletions(-)


[flink-jira-bot] 47/47: Merge pull request #15 from knaufk/FLINK-22569

2021-05-19 Thread knaufk
This is an automated email from the ASF dual-hosted git repository.

knaufk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink-jira-bot.git

commit dcb4a4476e5d332cc62c96786c31a7eebc0cf070
Merge: a43b94f 59c16f5
Author: Konstantin Knauf 
AuthorDate: Wed May 19 10:09:15 2021 +0200

Merge pull request #15 from knaufk/FLINK-22569

[FLINK-22569] limit number of tickets touched by the bot per run to 100

 config.yaml|  7 ++-
 flink_jira_rule.py | 17 +
 2 files changed, 15 insertions(+), 9 deletions(-)


[flink-jira-bot] 19/47: [FLINK-22033] add rule 2, which unassign stale assigned tickets after some time

2021-05-19 Thread knaufk
This is an automated email from the ASF dual-hosted git repository.

knaufk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink-jira-bot.git

commit a38d571a76c617d222e3fab5488c0ffe6d44119f
Author: Konstantin Knauf 
AuthorDate: Fri Apr 16 10:57:55 2021 +0200

[FLINK-22033] add rule 2, which unassign stale assigned tickets after some 
time
---
 README.md |   8 ++--
 config.yaml   |   8 
 flink_jira_bot.py | 116 ++
 3 files changed, 121 insertions(+), 11 deletions(-)

diff --git a/README.md b/README.md
index befa400..503a762 100644
--- a/README.md
+++ b/README.md
@@ -42,11 +42,13 @@ The configuration of the rules can be found in 
[config.yaml](config.yaml).
 
 ### Rule 1 (not implemented yet)
 
-### Rule 2 (not implemented yet)
+### Rule 2: Unassign Stale Assigned Tickets
 
-### Rule 3
+Assigned tickets without an update for {stale_assigned.stale_days} are 
unassigned after a warning period of {stale_assigned.warning_days}. Before this 
happens the assignee is notified that this is about to happen and asked for an 
update on the status of her contribution.
 
-An unresolved Minor ticket without an update for {stale.minor.stale_days} is 
closed after a warning period of {stale.minor.warning_days} with a comment that 
encourages users to watch, comment and simply reopen with a higher priority if 
the problem insists.
+### Rule 3: Close Stale Minor Tickets
+
+An unresolved Minor ticket without an update for {stale_minor.stale_days} is 
closed after a warning period of {stale_minor.warning_days} with a comment that 
encourages users to watch, comment and simply reopen with a higher priority if 
the problem insists.
 
 ## About Apache Flink
 
diff --git a/config.yaml b/config.yaml
index 1afae72..d1cb3bb 100644
--- a/config.yaml
+++ b/config.yaml
@@ -16,6 +16,14 @@
 # limitations under the License.
 

 
+stale_assigned:
+stale_days: 7
+warning_days: 7
+warning_label: "stale-assigned"
+warning_comment: 'This issue is assigned but has not received an update in 
{stale_days} days so it has been labeled "{warning_label}". If you are still 
working on the issue, please give an update and remove the label. If you are no 
longer working on the issue, please unassign so someone else may work on it. In 
{warning_days} days the issue will be automatically unassigned.'
+done_label: "auto-unassigned"
+done_comment: 'This issue was marked "{warning_label}" and has not 
received an update in {warning_days} days. It is now automatically unassigned. 
If you are still working on it, you can assign it to yourself again. Please 
also give an update about the status of the work.'
+
 stale_minor:
 stale_days: 180
 warning_days: 7
diff --git a/flink_jira_bot.py b/flink_jira_bot.py
index f67e57e..e1cdc28 100644
--- a/flink_jira_bot.py
+++ b/flink_jira_bot.py
@@ -33,12 +33,32 @@ class FlinkJiraRule:
 self.config = config
 self.is_dry_run = is_dry_run
 
+def get_issues(self, jql_query):
+"""Queries the JIRA PI for all issues that match the given JQL Query
+
+This method is necessary as requests tend to time out if the number of 
results reaches a certain number.
+So, this method requests the results in multiple queries and returns a 
final list of all issues.
+:param jql_query: the search query
+:return: a list of issues matching the query
+"""
+limit = 200
+current = 0
+total = 1
+issues = []
+while current < total:
+response = self.jira_client.jql(jql_query, limit=limit, 
start=current)
+total = response["total"]
+issues = issues + response["issues"]
+current = len(issues)
+logging.info(f'"{jql_query}" returned {len(issues)} issues')
+return issues
+
 def has_recently_updated_subtask(self, parent, updated_within_days):
 find_subtasks_updated_within = (
 f"parent = {parent}  AND updated > 
startOfDay(-{updated_within_days}d)"
 )
-issues = self.jira_client.jql(find_subtasks_updated_within, limit=1)
-return issues["total"] > 0
+issues = self.get_issues(find_subtasks_updated_within)
+return len(issues) > 0
 
 def add_label(self, issue, label):
 labels = issue["fields"]["labels"] + [label]
@@ -75,6 +95,12 @@ class FlinkJiraRule:
 else:
 logging.info(f"DRY_RUN (({key})): Closing.")
 
+def unassign(self, key):
+if not self.is_dry_run:
+self.jira_client.assign_issue(key, None)
+else:
+logging.info(f"DRY_RUN (({key})): Unassigning.")
+
 @abc.abstractmethod
 def run(self):
 return
@@ -101,11 +127,11 @@ class Rule3(FlinkJiraRule):
 f'("{self.warning_label}") AND updated < 

[flink-jira-bot] 42/47: [FLINK-22576] Set status to 'Open' when unassigning

2021-05-19 Thread knaufk
This is an automated email from the ASF dual-hosted git repository.

knaufk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink-jira-bot.git

commit f185d8654881b1a14ac11f112848aa2b7be75de7
Author: Chesnay Schepler 
AuthorDate: Mon May 10 16:39:25 2021 +0200

[FLINK-22576] Set status to 'Open' when unassigning
---
 flink_jira_rule.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/flink_jira_rule.py b/flink_jira_rule.py
index f11f275..a98ca71 100644
--- a/flink_jira_rule.py
+++ b/flink_jira_rule.py
@@ -99,6 +99,9 @@ class FlinkJiraRule:
 
 def unassign(self, key):
 if not self.is_dry_run:
+if self.jira_client.get_issue_status(key) == "In Progress":
+self.jira_client.assign_issue(key, self.jira_client.username)
+self.jira_client.set_issue_status(key, "Open")
 self.jira_client.assign_issue(key, None)
 else:
 logging.info(f"DRY_RUN (({key})): Unassigning.")


[flink-jira-bot] 30/47: [FLINK-22034] get rid of LOWER_PRIORITIES constant

2021-05-19 Thread knaufk
This is an automated email from the ASF dual-hosted git repository.

knaufk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink-jira-bot.git

commit 3fcb3fff062c80d08c22c816836d600155e009af
Author: Konstantin Knauf 
AuthorDate: Thu Apr 22 10:54:11 2021 +0200

[FLINK-22034] get rid of LOWER_PRIORITIES constant
---
 flink_jira_bot.py| 6 +++---
 stale_major_or_above_rule.py | 9 +++--
 2 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/flink_jira_bot.py b/flink_jira_bot.py
index aa1befa..36f8ca0 100644
--- a/flink_jira_bot.py
+++ b/flink_jira_bot.py
@@ -67,13 +67,13 @@ if __name__ == "__main__":
 )
 stale_minor_rule = StaleMinorRule(jira, jira_bot_config["stale_minor"], 
args.dryrun)
 stale_major_rule = StaleMajorOrAboveRule(
-jira, jira_bot_config["stale_major"], args.dryrun, "Major"
+jira, jira_bot_config["stale_major"], args.dryrun, "Major", "Minor"
 )
 stale_critical_rule = StaleMajorOrAboveRule(
-jira, jira_bot_config["stale_critical"], args.dryrun, "Critical"
+jira, jira_bot_config["stale_critical"], args.dryrun, "Critical", 
"Major"
 )
 stale_blocker_rule = StaleMajorOrAboveRule(
-jira, jira_bot_config["stale_blocker"], args.dryrun, "Blocker"
+jira, jira_bot_config["stale_blocker"], args.dryrun, "Blocker", 
"Critical"
 )
 stale_assigned_rule.run()
 stale_minor_rule.run()
diff --git a/stale_major_or_above_rule.py b/stale_major_or_above_rule.py
index d5e5663..c5509a0 100644
--- a/stale_major_or_above_rule.py
+++ b/stale_major_or_above_rule.py
@@ -16,8 +16,6 @@
 # limitations under the License.
 

 
-import logging
-
 from flink_jira_rule import FlinkJiraRule
 
 
@@ -31,12 +29,11 @@ class StaleMajorOrAboveRule(FlinkJiraRule):
 The time periods before warning differ based on the priority:
 """
 
-def __init__(self, jira_client, config, is_dry_run, priority):
+def __init__(self, jira_client, config, is_dry_run, priority, 
lower_priority):
 super().__init__(jira_client, config, is_dry_run)
+self.lower_priority = lower_priority
 self.priority = priority
 
-LOWER_PRIORITIES = {"Blocker": "Critical", "Critical": "Major", "Major": 
"Minor"}
-
 def run(self):
 self.handle_tickets_marked_stale(
 f"project=FLINK AND Priority = {self.priority} AND resolution = 
Unresolved "
@@ -49,4 +46,4 @@ class StaleMajorOrAboveRule(FlinkJiraRule):
 )
 
 def handle_stale_ticket(self, key):
-self.set_priority(key, self.LOWER_PRIORITIES[self.priority])
+self.set_priority(key, self.lower_priority)


[flink-jira-bot] 36/47: Merge pull request #10 from knaufk/FLINK-22429

2021-05-19 Thread knaufk
This is an automated email from the ASF dual-hosted git repository.

knaufk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink-jira-bot.git

commit 673419a672b02d6f83b2c13e9aded14f153eebd0
Merge: dfb2fd8 0b403ff
Author: Konstantin Knauf 
AuthorDate: Fri Apr 23 15:52:54 2021 +0200

Merge pull request #10 from knaufk/FLINK-22429

[FLINK-22429] exclude Sub-Tasks form stale-major+ and stale-minor rule

 stale_major_or_above_rule.py | 4 ++--
 stale_minor_rule.py  | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)


[flink-jira-bot] 32/47: [FLINK-22036] clarify relationship between README and Confluence page

2021-05-19 Thread knaufk
This is an automated email from the ASF dual-hosted git repository.

knaufk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink-jira-bot.git

commit c41f7fd44fc860743b5f1b4459724e70bbeb7e46
Author: Konstantin Knauf 
AuthorDate: Thu Apr 22 11:47:29 2021 +0200

[FLINK-22036] clarify relationship between README and Confluence page
---
 README.md | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/README.md b/README.md
index a91e616..eb3c7b6 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
 # Apache Flink Jira Bot
 
-The Flink Jira enforces some of the rules outlined in [the Apache Flink 
Confluence](https://cwiki.apache.org/confluence/display/FLINK/Flink+Jira+Process).
+The Flink Jira Bot partially enforces the Apache Flink Jira process. Please 
see [Apache Flink Jira 
Process](https://cwiki.apache.org/confluence/display/FLINK/Flink+Jira+Process) 
for all the guidlines and conventions that we try to follow.
 
 ## Usage
 
@@ -59,4 +59,5 @@ An unresolved Minor ticket without an update for 
{stale_minor.stale_days} is clo
 
 Apache Flink is an open source project of The Apache Software Foundation (ASF).
 
-Flink is distributed data processing framework with powerful stream and batch 
processing capabilities. Learn more about Flink at http://flink.apache.org/
\ No newline at end of file
+Flink is a distributed data processing framework with powerful stream and 
batch processing capabilities. Learn more about Flink at 
http://flink.apache.org/
+


[flink-jira-bot] 34/47: [hotfix] clarify intetion of stale_assigned comment

2021-05-19 Thread knaufk
This is an automated email from the ASF dual-hosted git repository.

knaufk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink-jira-bot.git

commit 723a958982add0cd6957463009ec0bbc7a3bb050
Author: Konstantin Knauf 
AuthorDate: Fri Apr 23 14:39:09 2021 +0200

[hotfix] clarify intetion of stale_assigned comment
---
 config.yaml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/config.yaml b/config.yaml
index 9428f9a..5f928b3 100644
--- a/config.yaml
+++ b/config.yaml
@@ -20,7 +20,7 @@ stale_assigned:
 stale_days: 14
 warning_days: 7
 warning_label: "stale-assigned"
-warning_comment: 'This issue is assigned but has not received an update in 
{stale_days} days so it has been labeled "{warning_label}". If you are still 
working on the issue, please give an update and remove the label. If you are no 
longer working on the issue, please unassign so someone else may work on it. In 
{warning_days} days the issue will be automatically unassigned.'
+warning_comment: 'This issue is assigned but has not received an update in 
{stale_days} days so it has been labeled "{warning_label}". If you are still 
working on the issue or are waiting for feedback from a Committer, please 
remove the label and optionally provide an update. If you are waiting for 
feedback, please consider this a reminder *to Committers/Reviewer* to get back 
to you. If you are no longer working on the issue, please unassign yourself so 
someone else may work on it. I [...]
 done_label: "auto-unassigned"
 done_comment: 'This issue was marked "{warning_label}" and has not 
received an update in {warning_days} days. It is now automatically unassigned. 
If you are still working on it, you can assign it to yourself again. Please 
also give an update about the status of the work.'
 


[flink-jira-bot] 27/47: [hotfix] move config parsing into FlinkJiraRule class

2021-05-19 Thread knaufk
This is an automated email from the ASF dual-hosted git repository.

knaufk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink-jira-bot.git

commit 836ee7d377f7b44a11e0bde9a8231de538772210
Author: Konstantin Knauf 
AuthorDate: Wed Apr 21 14:08:28 2021 +0200

[hotfix] move config parsing into FlinkJiraRule class
---
 flink_jira_bot.py| 12 +++-
 flink_jira_rule.py   |  7 ++-
 stale_assigned_rule.py   |  6 --
 stale_major_or_above_rule.py | 14 --
 stale_minor_rule.py  |  6 --
 5 files changed, 17 insertions(+), 28 deletions(-)

diff --git a/flink_jira_bot.py b/flink_jira_bot.py
index 80a58e9..aa1befa 100644
--- a/flink_jira_bot.py
+++ b/flink_jira_bot.py
@@ -62,16 +62,18 @@ if __name__ == "__main__":
 password=os.environ["JIRA_PASSWORD"],
 )
 
-stale_assigned_rule = StaleAssignedRule(jira, jira_bot_config, args.dryrun)
-stale_minor_rule = StaleMinorRule(jira, jira_bot_config, args.dryrun)
+stale_assigned_rule = StaleAssignedRule(
+jira, jira_bot_config["stale_assigned"], args.dryrun
+)
+stale_minor_rule = StaleMinorRule(jira, jira_bot_config["stale_minor"], 
args.dryrun)
 stale_major_rule = StaleMajorOrAboveRule(
-jira, jira_bot_config, args.dryrun, "Major"
+jira, jira_bot_config["stale_major"], args.dryrun, "Major"
 )
 stale_critical_rule = StaleMajorOrAboveRule(
-jira, jira_bot_config, args.dryrun, "Critical"
+jira, jira_bot_config["stale_critical"], args.dryrun, "Critical"
 )
 stale_blocker_rule = StaleMajorOrAboveRule(
-jira, jira_bot_config, args.dryrun, "Blocker"
+jira, jira_bot_config["stale_blocker"], args.dryrun, "Blocker"
 )
 stale_assigned_rule.run()
 stale_minor_rule.run()
diff --git a/flink_jira_rule.py b/flink_jira_rule.py
index 566fce7..c453562 100644
--- a/flink_jira_rule.py
+++ b/flink_jira_rule.py
@@ -25,8 +25,13 @@ class FlinkJiraRule:
 
 def __init__(self, jira_client, config, is_dry_run):
 self.jira_client = jira_client
-self.config = config
 self.is_dry_run = is_dry_run
+self.stale_days = config["stale_days"].get()
+self.warning_days = config["warning_days"].get()
+self.warning_label = config["warning_label"].get()
+self.done_label = config["done_label"].get()
+self.done_comment = config["done_comment"].get()
+self.warning_comment = config["warning_comment"].get()
 
 def get_issues(self, jql_query):
 """Queries the JIRA PI for all issues that match the given JQL Query
diff --git a/stale_assigned_rule.py b/stale_assigned_rule.py
index e781a9d..ddee747 100644
--- a/stale_assigned_rule.py
+++ b/stale_assigned_rule.py
@@ -30,12 +30,6 @@ class StaleAssignedRule(FlinkJiraRule):
 
 def __init__(self, jira_client, config, is_dry_run):
 super().__init__(jira_client, config, is_dry_run)
-self.stale_days = config["stale_assigned"]["stale_days"].get()
-self.warning_days = config["stale_assigned"]["warning_days"].get()
-self.warning_label = config["stale_assigned"]["warning_label"].get()
-self.done_label = config["stale_assigned"]["done_label"].get()
-self.done_comment = config["stale_assigned"]["done_comment"].get()
-self.warning_comment = 
config["stale_assigned"]["warning_comment"].get()
 
 def run(self):
 self.unassign_tickets_marked_stale()
diff --git a/stale_major_or_above_rule.py b/stale_major_or_above_rule.py
index de3cb17..aeda3f1 100644
--- a/stale_major_or_above_rule.py
+++ b/stale_major_or_above_rule.py
@@ -33,14 +33,6 @@ class StaleMajorOrAboveRule(FlinkJiraRule):
 
 def __init__(self, jira_client, config, is_dry_run, priority):
 super().__init__(jira_client, config, is_dry_run)
-self.stale_days = 
config[f"stale_{priority.lower()}"]["stale_days"].get()
-self.warning_days = 
config[f"stale_{priority.lower()}"]["warning_days"].get()
-self.warning_label = 
config[f"stale_{priority.lower()}"]["warning_label"].get()
-self.done_label = 
config[f"stale_{priority.lower()}"]["done_label"].get()
-self.done_comment = 
config[f"stale_{priority.lower()}"]["done_comment"].get()
-self.warning_comment = config[f"stale_{priority.lower()}"][
-"warning_comment"
-].get()
 self.priority = priority
 
 LOWER_PRIORITIES = {"Blocker": "Critical", "Critical": "Major", "Major": 
"Minor"}
@@ -78,8 +70,10 @@ class StaleMajorOrAboveRule(FlinkJiraRule):
 
 def mark_stale_tickets_stale(self):
 
-stale_tickets = f"project=FLINK AND priority = {self.priority} AND 
resolution = Unresolved AND assignee is " \
-f"empty AND updated < startOfDay(-{self.stale_days}d)"
+stale_tickets = (
+f"project=FLINK AND priority = {self.priority} AND resolution = 
Unresolved AND assignee is "
+f"empty 

[flink-jira-bot] 41/47: Merge pull request #12 from knaufk/hotfix-config-formatting

2021-05-19 Thread knaufk
This is an automated email from the ASF dual-hosted git repository.

knaufk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink-jira-bot.git

commit fe3c5db836bbfd7b8311b1d865fdf0b4d79c192f
Merge: 9e04944 1c4ab41
Author: Konstantin Knauf 
AuthorDate: Thu Apr 29 10:23:48 2021 +0200

Merge pull request #12 from knaufk/hotfix-config-formatting

[hotfix] fix indentation in config.yaml

 config.yaml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)


[flink-jira-bot] 38/47: Merge pull request #8 from knaufk/FLINK-22036

2021-05-19 Thread knaufk
This is an automated email from the ASF dual-hosted git repository.

knaufk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink-jira-bot.git

commit 67b61dc4dc756459d3e442f158516d32eec82c0e
Merge: 37190da c41f7fd
Author: Konstantin Knauf 
AuthorDate: Mon Apr 26 10:35:40 2021 +0200

Merge pull request #8 from knaufk/FLINK-22036

[FLINK-22036] clarify relationship between README and Confluence page

 README.md | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)


[flink-jira-bot] 35/47: [FLINK-22429] exclude Sub-Tasks form stale-major+ and stale-minor rule

2021-05-19 Thread knaufk
This is an automated email from the ASF dual-hosted git repository.

knaufk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink-jira-bot.git

commit 0b403ff3b212008819f53ecfa995e34b58b9b95f
Author: Konstantin Knauf 
AuthorDate: Fri Apr 23 14:52:41 2021 +0200

[FLINK-22429] exclude Sub-Tasks form stale-major+ and stale-minor rule
---
 stale_major_or_above_rule.py | 4 ++--
 stale_minor_rule.py  | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/stale_major_or_above_rule.py b/stale_major_or_above_rule.py
index c5509a0..dd256b2 100644
--- a/stale_major_or_above_rule.py
+++ b/stale_major_or_above_rule.py
@@ -41,8 +41,8 @@ class StaleMajorOrAboveRule(FlinkJiraRule):
 f"AND updated < startOfDay(-{self.warning_days}d)"
 )
 self.mark_stale_tickets_stale(
-f"project=FLINK AND priority = {self.priority} AND resolution = 
Unresolved "
-f"AND assignee is empty AND updated < 
startOfDay(-{self.stale_days}d)"
+f'project=FLINK AND type != "Sub-Task" AND priority = 
{self.priority} AND resolution = Unresolved '
+f'AND assignee is empty AND updated < 
startOfDay(-{self.stale_days}d)'
 )
 
 def handle_stale_ticket(self, key):
diff --git a/stale_minor_rule.py b/stale_minor_rule.py
index 0bef5d9..ae54dac 100644
--- a/stale_minor_rule.py
+++ b/stale_minor_rule.py
@@ -38,8 +38,8 @@ class StaleMinorRule(FlinkJiraRule):
 f"AND updated < startOfDay(-{self.warning_days}d)"
 )
 self.mark_stale_tickets_stale(
-f"project = FLINK AND Priority = Minor AND resolution = Unresolved 
"
-f"AND updated < startOfDay(-{self.stale_days}d)"
+f'project = FLINK AND type != "Sub-Task" AND Priority = Minor AND 
resolution = Unresolved '
+f'AND updated < startOfDay(-{self.stale_days}d)'
 )
 
 def handle_stale_ticket(self, key):


[flink-jira-bot] 39/47: [hotfix] Make comment language friendly to contributors

2021-05-19 Thread knaufk
This is an automated email from the ASF dual-hosted git repository.

knaufk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink-jira-bot.git

commit 9e049443dedc71c381bb8628991e92a3b538dc5e
Author: Seth Wiesman 
AuthorDate: Fri Apr 23 11:10:07 2021 -0500

[hotfix] Make comment language friendly to contributors

Co-authored-by: Konstantin Knauf 

This closes #11
---
 config.yaml | 37 +++--
 1 file changed, 27 insertions(+), 10 deletions(-)

diff --git a/config.yaml b/config.yaml
index 5f928b3..b472cf2 100644
--- a/config.yaml
+++ b/config.yaml
@@ -20,38 +20,55 @@ stale_assigned:
 stale_days: 14
 warning_days: 7
 warning_label: "stale-assigned"
-warning_comment: 'This issue is assigned but has not received an update in 
{stale_days} days so it has been labeled "{warning_label}". If you are still 
working on the issue or are waiting for feedback from a Committer, please 
remove the label and optionally provide an update. If you are waiting for 
feedback, please consider this a reminder *to Committers/Reviewer* to get back 
to you. If you are no longer working on the issue, please unassign yourself so 
someone else may work on it. I [...]
 done_label: "auto-unassigned"
-done_comment: 'This issue was marked "{warning_label}" and has not 
received an update in {warning_days} days. It is now automatically unassigned. 
If you are still working on it, you can assign it to yourself again. Please 
also give an update about the status of the work.'
+warning_comment: |
+I am the [Flink Jira Bot|https://github.com/apache/flink-jira-bot/] 
and I help the community manage its development. I see this issue is assigned 
but has not received an update in {stale_days}, so it has been labeled 
"{warning_label}".
+If you are still working on the issue, please remove the label and add 
a comment updating the community on your progress.  If this issue is waiting on 
feedback, please consider this a reminder to the committer/reviewer. Flink is a 
very active project, and so we appreciate your patience.
+If you are no longer working on the issue, please unassign yourself so 
someone else may work on it. If the "warning_label" label is not removed in 
{warning_days} days, the issue will be automatically unassigned.
+
+done_comment: |
+This issue was marked "{warning_label}" {warning_days} ago and has not 
received an update. I have automatically removed the current assignee from the 
issue so others in the community may pick it up. If you are still working on 
this ticket, please ask a committer to reassign you and provide an update about 
your current status.
 
 stale_minor:
 stale_days: 180
 warning_days: 7
 warning_label: "stale-minor"
-warning_comment: 'This issue and all of its Sub-Tasks have not been 
updated for {stale_days} days. So, it has been labeled "{warning_label}". If 
you are still affected by this bug or are still interested in this issue, 
please give an update and remove the label. In {warning_days} days the issue 
will be closed automatically.'
 done_label: "auto-closed"
-done_comment: 'This issue has been labeled "{warning_label}" for 
{warning_days} days. It is closed now. If you are still affected by this or 
would like to raise the priority of this ticket please re-open, removing the 
label "{done_label}" and raise the ticket priority accordingly.'
+warning_comment: |
+I am the [Flink Jira Bot|https://github.com/apache/flink-jira-bot/] 
and I help the community manage its development. I noticed that neither this 
issue nor its subtasks had updates for {state_days} days, so I labeled it 
"{warning_label}".  If you are still affected by this bug or are still 
interested in this issue, please update and remove the label.
+
+done_comment: |
+This issue was labeled "{warning_label}" {warning_days} ago and has 
not received any updates so I have gone ahead and closed it.  If you are still 
affected by this or would like to raise the priority of this ticket please 
re-open, removing the label "{done_label}" and raise the ticket priority 
accordingly.
 
 stale_blocker:
 stale_days: 1
 warning_days: 7
 warning_label: "stale-blocker"
-warning_comment: 'This Blockers is unassigned and itself and all of its 
Sub-Tasks have not been updated for {stale_days} days. So, it has been labeled 
"{warning_label}". If this ticket is a Blocker, please either assign yourself 
or give an update. Afterwards, please remove the label. In {warning_days} days 
the issue will be deprioritized.'
 done_label: "auto-deprioritized-blocker"
-done_comment: 'This issue has been labeled "{warning_label}" for 
{warning_days} days. It is deprioritized now. If this ticket is actually a 
Blocker, please raise the ticket priority again and assign yourself or revive 
the public discussion.'
+warning_comment: |
+I am the 

[flink-jira-bot] 33/47: [FLINK-22340] set stale_assigned.stale_days to 14

2021-05-19 Thread knaufk
This is an automated email from the ASF dual-hosted git repository.

knaufk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink-jira-bot.git

commit 0b934ae3036d494f830d80db41bb639b6b25c41b
Author: Konstantin Knauf 
AuthorDate: Fri Apr 23 14:33:15 2021 +0200

[FLINK-22340] set stale_assigned.stale_days to 14
---
 config.yaml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/config.yaml b/config.yaml
index d0e7aff..9428f9a 100644
--- a/config.yaml
+++ b/config.yaml
@@ -17,7 +17,7 @@
 

 
 stale_assigned:
-stale_days: 7
+stale_days: 14
 warning_days: 7
 warning_label: "stale-assigned"
 warning_comment: 'This issue is assigned but has not received an update in 
{stale_days} days so it has been labeled "{warning_label}". If you are still 
working on the issue, please give an update and remove the label. If you are no 
longer working on the issue, please unassign so someone else may work on it. In 
{warning_days} days the issue will be automatically unassigned.'


[flink-jira-bot] 45/47: [hotfix] fix typo in one of the comments

2021-05-19 Thread knaufk
This is an automated email from the ASF dual-hosted git repository.

knaufk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink-jira-bot.git

commit 9c2998af4f06df151ab2b21252814c20a54a6edf
Author: Konstantin Knauf 
AuthorDate: Tue May 18 19:15:57 2021 +0200

[hotfix] fix typo in one of the comments
---
 config.yaml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/config.yaml b/config.yaml
index 2e48bb0..50091da 100644
--- a/config.yaml
+++ b/config.yaml
@@ -35,7 +35,7 @@ stale_minor:
 warning_label: "stale-minor"
 done_label: "auto-closed"
 warning_comment: |
-I am the [Flink Jira Bot|https://github.com/apache/flink-jira-bot/] 
and I help the community manage its development. I noticed that neither this 
issue nor its subtasks had updates for {state_days} days, so I labeled it 
"{warning_label}".  If you are still affected by this bug or are still 
interested in this issue, please update and remove the label.
+I am the [Flink Jira Bot|https://github.com/apache/flink-jira-bot/] 
and I help the community manage its development. I noticed that neither this 
issue nor its subtasks had updates for {stale_days} days, so I labeled it 
"{warning_label}".  If you are still affected by this bug or are still 
interested in this issue, please update and remove the label.
 
 done_comment: |
 This issue was labeled "{warning_label}" {warning_days} ago and has 
not received any updates so I have gone ahead and closed it.  If you are still 
affected by this or would like to raise the priority of this ticket please 
re-open, removing the label "{done_label}" and raise the ticket priority 
accordingly.


[flink-jira-bot] 43/47: [FLINK-22570] combine jira client calls and reduce number of notifications to one per ticket per rule

2021-05-19 Thread knaufk
This is an automated email from the ASF dual-hosted git repository.

knaufk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink-jira-bot.git

commit 7cccb045fb9a53d1e8d5b72a644099b0a90bc08d
Author: Konstantin Knauf 
AuthorDate: Tue May 18 19:03:50 2021 +0200

[FLINK-22570] combine jira client calls and reduce number of notifications 
to one per ticket per rule
---
 flink_jira_rule.py   | 65 +++-
 stale_assigned_rule.py   | 25 +++--
 stale_major_or_above_rule.py | 20 --
 stale_minor_rule.py  | 22 +--
 4 files changed, 69 insertions(+), 63 deletions(-)

diff --git a/flink_jira_rule.py b/flink_jira_rule.py
index a98ca71..3f784d7 100644
--- a/flink_jira_rule.py
+++ b/flink_jira_rule.py
@@ -60,58 +60,14 @@ class FlinkJiraRule:
 issues = self.get_issues(find_subtasks_updated_within)
 return len(issues) > 0
 
-def add_label(self, issue, label):
-labels = issue["fields"]["labels"] + [label]
-fields = {"labels": labels}
-key = issue["key"]
-
-if not self.is_dry_run:
-self.jira_client.update_issue_field(key, fields)
-else:
-logging.info(f'DRY RUN ({key}): Adding label "{label}".')
-
-def replace_label(self, issue, old_label, new_label):
-labels = issue["fields"]["labels"] + [new_label]
-labels.remove(old_label)
-fields = {"labels": labels}
-key = issue["key"]
-
-if not self.is_dry_run:
-self.jira_client.update_issue_field(key, fields)
-else:
-logging.info(
-f'DRY RUN ({key}): Replace label "{old_label}" for 
"{new_label}".'
-)
-
-def add_comment(self, key, comment):
+def add_label_with_comment(self, key, label, comment):
 if not self.is_dry_run:
-self.jira_client.issue_add_comment(key, comment)
-else:
-logging.info(f'DRY_RUN ({key}): Adding comment "{comment}".')
-
-def close_issue(self, key):
-if not self.is_dry_run:
-self.jira_client.set_issue_status(
-key, "Closed", fields={"resolution": {"name": "Auto Closed"}}
+self.jira_client.edit_issue(
+key,
+{"labels": [{"add": label}], "comment": [{"add": {"body": 
comment}}]},
 )
 else:
-logging.info(f"DRY_RUN (({key})): Closing.")
-
-def unassign(self, key):
-if not self.is_dry_run:
-if self.jira_client.get_issue_status(key) == "In Progress":
-self.jira_client.assign_issue(key, self.jira_client.username)
-self.jira_client.set_issue_status(key, "Open")
-self.jira_client.assign_issue(key, None)
-else:
-logging.info(f"DRY_RUN (({key})): Unassigning.")
-
-def set_priority(self, key, priority):
-if not self.is_dry_run:
-fields = {"priority": {"name": priority}}
-self.jira_client.update_issue_field(key, fields)
-else:
-logging.info(f"DRY_RUN (({key})): Setting to {priority}")
+logging.info(f'DRY RUN ({key}): Adding label "{label}".')
 
 @abc.abstractmethod
 def run(self):
@@ -140,12 +96,11 @@ class FlinkJiraRule:
 warning_label=self.warning_label,
 )
 
-self.add_label(issue, self.warning_label)
-self.add_comment(key, formatted_comment)
+self.add_label_with_comment(key, self.warning_label, 
formatted_comment)
 
 else:
 logging.info(
-f"Found https://issues.apache.org/jira/browse/{key}, but 
is has recently updated Subtasks. "
+f"Found https://issues.apache.org/jira/browse/{key}, but 
is has recently updated Subtasks."
 f"Ignoring for now."
 )
 
@@ -165,6 +120,6 @@ class FlinkJiraRule:
 done_label=self.done_label,
 )
 
-self.add_comment(key, formatted_comment)
-self.replace_label(issue, self.warning_label, self.done_label)
-self.handle_stale_ticket(key)
+self.handle_stale_ticket(
+key, self.warning_label, self.done_label, formatted_comment
+)
diff --git a/stale_assigned_rule.py b/stale_assigned_rule.py
index 26c7b00..d5cb41c 100644
--- a/stale_assigned_rule.py
+++ b/stale_assigned_rule.py
@@ -41,5 +41,26 @@ class StaleAssignedRule(FlinkJiraRule):
 f"AND updated < startOfDay(-{self.stale_days}d)"
 )
 
-def handle_stale_ticket(self, key):
-self.unassign(key)
+def handle_stale_ticket(self, key, warning_label, done_label, comment):
+self.unassign(key, warning_label, done_label, comment)
+
+def unassign(self, key, warning_label, done_label, comment):
+if not self.is_dry_run:
+if 

[flink-jira-bot] 40/47: [hotfix] fix indentation in config.yaml

2021-05-19 Thread knaufk
This is an automated email from the ASF dual-hosted git repository.

knaufk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink-jira-bot.git

commit 1c4ab41fce24bca9805bd8de405d87be1bddfaa3
Author: Konstantin Knauf 
AuthorDate: Thu Apr 29 10:16:26 2021 +0200

[hotfix] fix indentation in config.yaml
---
 config.yaml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/config.yaml b/config.yaml
index b472cf2..2e48bb0 100644
--- a/config.yaml
+++ b/config.yaml
@@ -70,5 +70,5 @@ stale_major:
 warning_comment: |
 I am the [Flink Jira Bot|https://github.com/apache/flink-jira-bot/] 
and I help the community manage its development. I see this issues has been 
marked as Major but is unassigned and neither itself nor its Sub-Tasks have 
been updated for {stale_days} days. I have gone ahead and added a 
"{warning_label}" to the issue". If this ticket is a Major, please either 
assign yourself or give an update. Afterwards, please remove the label or in 
{warning_days} days the issue will be deprioritized.
 
-done_comment: |
-This issue was labeled "{warning_label}" {warning_days} ago and has not 
received any updates so it is being deprioritized. If this ticket is actually 
Major, please raise the priority and ask a committer to assign you the issue or 
revive the public discussion.
+done_comment: |
+This issue was labeled "{warning_label}" {warning_days} ago and has 
not received any updates so it is being deprioritized. If this ticket is 
actually Major, please raise the priority and ask a committer to assign you the 
issue or revive the public discussion.


[flink-jira-bot] 29/47: [hotfix] pull up logic to handle stale tickets

2021-05-19 Thread knaufk
This is an automated email from the ASF dual-hosted git repository.

knaufk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink-jira-bot.git

commit a6002490ef50be5f4b3c103ba80db0d90d307c97
Author: Konstantin Knauf 
AuthorDate: Wed Apr 21 14:42:06 2021 +0200

[hotfix] pull up logic to handle stale tickets
---
 flink_jira_rule.py   | 24 
 stale_assigned_rule.py   | 33 ++---
 stale_major_or_above_rule.py | 34 +++---
 stale_minor_rule.py  | 34 +++---
 4 files changed, 44 insertions(+), 81 deletions(-)

diff --git a/flink_jira_rule.py b/flink_jira_rule.py
index ff32a1e..f11f275 100644
--- a/flink_jira_rule.py
+++ b/flink_jira_rule.py
@@ -114,6 +114,10 @@ class FlinkJiraRule:
 def run(self):
 return
 
+@abc.abstractmethod
+def handle_stale_ticket(self, key):
+return
+
 def mark_stale_tickets_stale(self, jql_query):
 
 logging.info(f"Looking for stale tickets.")
@@ -141,3 +145,23 @@ class FlinkJiraRule:
 f"Found https://issues.apache.org/jira/browse/{key}, but 
is has recently updated Subtasks. "
 f"Ignoring for now."
 )
+
+def handle_tickets_marked_stale(self, jql_query):
+logging.info(f"Looking for ticket previously marked as 
{self.warning_label}.")
+issues = self.get_issues(jql_query)
+
+for issue in issues:
+key = issue["key"]
+logging.info(
+f"Found https://issues.apache.org/jira/browse/{key}. It is now 
processed as stale."
+)
+
+formatted_comment = self.done_comment.format(
+warning_days=self.warning_days,
+warning_label=self.warning_label,
+done_label=self.done_label,
+)
+
+self.add_comment(key, formatted_comment)
+self.replace_label(issue, self.warning_label, self.done_label)
+self.handle_stale_ticket(key)
diff --git a/stale_assigned_rule.py b/stale_assigned_rule.py
index cb672d4..26c7b00 100644
--- a/stale_assigned_rule.py
+++ b/stale_assigned_rule.py
@@ -32,35 +32,14 @@ class StaleAssignedRule(FlinkJiraRule):
 super().__init__(jira_client, config, is_dry_run)
 
 def run(self):
-self.unassign_tickets_marked_stale()
-self.mark_stale_tickets_stale(
-f"project = FLINK AND resolution = Unresolved AND assignee is not 
EMPTY "
-f"AND updated < startOfDay(-{self.stale_days}d)"
-)
-
-def unassign_tickets_marked_stale(self):
-
-assigned_tickets_marked_stale = (
+self.handle_tickets_marked_stale(
 f"project=FLINK AND resolution = Unresolved AND labels in "
 f'("{self.warning_label}") AND updated < 
startOfDay(-{self.warning_days}d)'
 )
-logging.info(
-f"Looking for assigned tickets, which were previously marked as 
{self.warning_label}."
+self.mark_stale_tickets_stale(
+f"project = FLINK AND resolution = Unresolved AND assignee is not 
EMPTY "
+f"AND updated < startOfDay(-{self.stale_days}d)"
 )
-issues = self.get_issues(assigned_tickets_marked_stale)
-
-for issue in issues:
-key = issue["key"]
-logging.info(
-f"Found https://issues.apache.org/jira/browse/{key}. It is now 
unassigned due to inactivity."
-)
-
-formatted_comment = self.done_comment.format(
-warning_days=self.warning_days,
-warning_label=self.warning_label,
-done_label=self.done_label,
-)
 
-self.add_comment(key, formatted_comment)
-self.replace_label(issue, self.warning_label, self.done_label)
-self.unassign(key)
+def handle_stale_ticket(self, key):
+self.unassign(key)
diff --git a/stale_major_or_above_rule.py b/stale_major_or_above_rule.py
index e37c9d1..d5e5663 100644
--- a/stale_major_or_above_rule.py
+++ b/stale_major_or_above_rule.py
@@ -38,35 +38,15 @@ class StaleMajorOrAboveRule(FlinkJiraRule):
 LOWER_PRIORITIES = {"Blocker": "Critical", "Critical": "Major", "Major": 
"Minor"}
 
 def run(self):
-self.close_tickets_marked_stale()
+self.handle_tickets_marked_stale(
+f"project=FLINK AND Priority = {self.priority} AND resolution = 
Unresolved "
+f'AND labels in ("{self.warning_label}") '
+f"AND updated < startOfDay(-{self.warning_days}d)"
+)
 self.mark_stale_tickets_stale(
 f"project=FLINK AND priority = {self.priority} AND resolution = 
Unresolved "
 f"AND assignee is empty AND updated < 
startOfDay(-{self.stale_days}d)"
 )
 
-def close_tickets_marked_stale(self):
-
-tickets_marked_stale = (
-f"project=FLINK AND 

[flink-jira-bot] 23/47: Merge pull request #6 from knaufk/FLINK-22394

2021-05-19 Thread knaufk
This is an automated email from the ASF dual-hosted git repository.

knaufk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink-jira-bot.git

commit 1bd0618237096e87cd08c827552e46f5325d5637
Merge: 8bf7d6a 5f209ae
Author: Konstantin Knauf 
AuthorDate: Wed Apr 21 13:01:32 2021 +0200

Merge pull request #6 from knaufk/FLINK-22394

[hotfix] Auto Close issues with resolution "Auto Closed" instead of "…

 flink_jira_bot.py | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)


[flink-jira-bot] 46/47: [FLINK-22569] limit number of tickets touched by the bot per run to 100

2021-05-19 Thread knaufk
This is an automated email from the ASF dual-hosted git repository.

knaufk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink-jira-bot.git

commit 59c16f595514c67983965d9580c7c0f45eebcaaf
Author: Konstantin Knauf 
AuthorDate: Tue May 18 19:16:33 2021 +0200

[FLINK-22569] limit number of tickets touched by the bot per run to 100
---
 config.yaml|  5 +
 flink_jira_rule.py | 17 +
 2 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/config.yaml b/config.yaml
index 50091da..f8aa8cf 100644
--- a/config.yaml
+++ b/config.yaml
@@ -17,6 +17,7 @@
 

 
 stale_assigned:
+ticket_limit: 10
 stale_days: 14
 warning_days: 7
 warning_label: "stale-assigned"
@@ -30,6 +31,7 @@ stale_assigned:
 This issue was marked "{warning_label}" {warning_days} ago and has not 
received an update. I have automatically removed the current assignee from the 
issue so others in the community may pick it up. If you are still working on 
this ticket, please ask a committer to reassign you and provide an update about 
your current status.
 
 stale_minor:
+ticket_limit: 10
 stale_days: 180
 warning_days: 7
 warning_label: "stale-minor"
@@ -41,6 +43,7 @@ stale_minor:
 This issue was labeled "{warning_label}" {warning_days} ago and has 
not received any updates so I have gone ahead and closed it.  If you are still 
affected by this or would like to raise the priority of this ticket please 
re-open, removing the label "{done_label}" and raise the ticket priority 
accordingly.
 
 stale_blocker:
+ticket_limit: 5
 stale_days: 1
 warning_days: 7
 warning_label: "stale-blocker"
@@ -52,6 +55,7 @@ stale_blocker:
 This issue was labeled "{warning_label}" {warning_days} ago and has 
not received any updates so it is being deprioritized. If this ticket is 
actually a Blocker, please raise the priority and ask a committer to assign you 
the issue or revive the public discussion.
 
 stale_critical:
+ticket_limit: 10
 stale_days: 7
 warning_days: 7
 warning_label: "stale-critical"
@@ -63,6 +67,7 @@ stale_critical:
 This issue was labeled "{warning_label}" {warning_days} ago and has 
not received any updates so it is being deprioritized. If this ticket is 
actually Critical, please raise the priority and ask a committer to assign you 
the issue or revive the public discussion.
 
 stale_major:
+ticket_limit: 15
 stale_days: 30
 warning_days: 7
 warning_label: "stale-major"
diff --git a/flink_jira_rule.py b/flink_jira_rule.py
index 3f784d7..f70ca3d 100644
--- a/flink_jira_rule.py
+++ b/flink_jira_rule.py
@@ -32,8 +32,9 @@ class FlinkJiraRule:
 self.done_label = config["done_label"].get()
 self.done_comment = config["done_comment"].get()
 self.warning_comment = config["warning_comment"].get()
+self.ticket_limit = config["ticket_limit"].get()
 
-def get_issues(self, jql_query):
+def get_issues(self, jql_query, limit):
 """Queries the JIRA PI for all issues that match the given JQL Query
 
 This method is necessary as requests tend to time out if the number of 
results reaches a certain number.
@@ -41,23 +42,23 @@ class FlinkJiraRule:
 :param jql_query: the search query
 :return: a list of issues matching the query
 """
-limit = 200
+limit_per_api_request = min(100, limit)
 current = 0
 total = 1
 issues = []
-while current < total:
-response = self.jira_client.jql(jql_query, limit=limit, 
start=current)
+while current < min(total, limit):
+response = self.jira_client.jql(jql_query, 
limit=limit_per_api_request, start=current)
 total = response["total"]
 issues = issues + response["issues"]
 current = len(issues)
 logging.info(f'"{jql_query}" returned {len(issues)} issues')
-return issues
+return issues[:min(limit, len(issues))]
 
 def has_recently_updated_subtask(self, parent, updated_within_days):
 find_subtasks_updated_within = (
 f"parent = {parent}  AND updated > 
startOfDay(-{updated_within_days}d)"
 )
-issues = self.get_issues(find_subtasks_updated_within)
+issues = self.get_issues(find_subtasks_updated_within, 1)
 return len(issues) > 0
 
 def add_label_with_comment(self, key, label, comment):
@@ -80,7 +81,7 @@ class FlinkJiraRule:
 def mark_stale_tickets_stale(self, jql_query):
 
 logging.info(f"Looking for stale tickets.")
-issues = self.get_issues(jql_query)
+issues = self.get_issues(jql_query, self.ticket_limit)
 
 for issue in issues:
 key = issue["key"]
@@ -106,7 +107,7 @@ class FlinkJiraRule:
 
 def handle_tickets_marked_stale(self, jql_query):
 

[flink-jira-bot] 20/47: [FLINK-22033] add docstring for rule classes

2021-05-19 Thread knaufk
This is an automated email from the ASF dual-hosted git repository.

knaufk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink-jira-bot.git

commit 77943a14746fbcdb8432863b07f0c8143d33f3fc
Author: Konstantin Knauf 
AuthorDate: Fri Apr 16 11:31:51 2021 +0200

[FLINK-22033] add docstring for rule classes
---
 flink_jira_bot.py | 12 
 1 file changed, 12 insertions(+)

diff --git a/flink_jira_bot.py b/flink_jira_bot.py
index e1cdc28..00ce80f 100644
--- a/flink_jira_bot.py
+++ b/flink_jira_bot.py
@@ -107,6 +107,12 @@ class FlinkJiraRule:
 
 
 class Rule3(FlinkJiraRule):
+"""
+An unresolved Minor ticket without an update for {stale_minor.stale_days} 
is closed after a warning period of
+{stale_minor.warning_days} with a comment that encourages users to watch, 
comment and simply reopen with a higher
+priority if the problem insists.
+"""
+
 def __init__(self, jira_client, config, is_dry_run):
 super().__init__(jira_client, config, is_dry_run)
 self.stale_days = config["stale_minor"]["stale_days"].get()
@@ -181,6 +187,12 @@ class Rule3(FlinkJiraRule):
 
 
 class Rule2(FlinkJiraRule):
+"""
+Assigned tickets without an update for {stale_assigned.stale_days} are 
unassigned after a warning period of
+{stale_assigned.warning_days}. Before this happens the assignee is 
notified that this is about to happen and
+asked for an update on the status of her contribution.
+"""
+
 def __init__(self, jira_client, config, is_dry_run):
 super().__init__(jira_client, config, is_dry_run)
 self.stale_days = config["stale_assigned"]["stale_days"].get()


[flink-jira-bot] 37/47: Merge pull request #9 from knaufk/FLINK-22340

2021-05-19 Thread knaufk
This is an automated email from the ASF dual-hosted git repository.

knaufk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink-jira-bot.git

commit 37190da20dd8586b277be0b13face6632706fdc1
Merge: 673419a 723a958
Author: Konstantin Knauf 
AuthorDate: Fri Apr 23 16:09:08 2021 +0200

Merge pull request #9 from knaufk/FLINK-22340

[FLINK-22340] adjust stale_assigned role

 config.yaml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)


[flink-jira-bot] 28/47: [hotfix] pull up logic for marking tickets stale

2021-05-19 Thread knaufk
This is an automated email from the ASF dual-hosted git repository.

knaufk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink-jira-bot.git

commit b342cb2168b941790ebefd36a780b80cd2c9dc96
Author: Konstantin Knauf 
AuthorDate: Wed Apr 21 14:18:09 2021 +0200

[hotfix] pull up logic for marking tickets stale
---
 flink_jira_rule.py   | 28 
 stale_assigned_rule.py   | 37 -
 stale_major_or_above_rule.py | 37 -
 stale_minor_rule.py  | 37 -
 4 files changed, 40 insertions(+), 99 deletions(-)

diff --git a/flink_jira_rule.py b/flink_jira_rule.py
index c453562..ff32a1e 100644
--- a/flink_jira_rule.py
+++ b/flink_jira_rule.py
@@ -113,3 +113,31 @@ class FlinkJiraRule:
 @abc.abstractmethod
 def run(self):
 return
+
+def mark_stale_tickets_stale(self, jql_query):
+
+logging.info(f"Looking for stale tickets.")
+issues = self.get_issues(jql_query)
+
+for issue in issues:
+key = issue["key"]
+issue = self.jira_client.get_issue(key)
+
+if not self.has_recently_updated_subtask(key, self.stale_days):
+logging.info(
+f"Found https://issues.apache.org/jira/browse/{key}. It is 
marked stale now."
+)
+formatted_comment = self.warning_comment.format(
+stale_days=self.stale_days,
+warning_days=self.warning_days,
+warning_label=self.warning_label,
+)
+
+self.add_label(issue, self.warning_label)
+self.add_comment(key, formatted_comment)
+
+else:
+logging.info(
+f"Found https://issues.apache.org/jira/browse/{key}, but 
is has recently updated Subtasks. "
+f"Ignoring for now."
+)
diff --git a/stale_assigned_rule.py b/stale_assigned_rule.py
index ddee747..cb672d4 100644
--- a/stale_assigned_rule.py
+++ b/stale_assigned_rule.py
@@ -33,7 +33,10 @@ class StaleAssignedRule(FlinkJiraRule):
 
 def run(self):
 self.unassign_tickets_marked_stale()
-self.mark_stale_tickets_stale()
+self.mark_stale_tickets_stale(
+f"project = FLINK AND resolution = Unresolved AND assignee is not 
EMPTY "
+f"AND updated < startOfDay(-{self.stale_days}d)"
+)
 
 def unassign_tickets_marked_stale(self):
 
@@ -61,35 +64,3 @@ class StaleAssignedRule(FlinkJiraRule):
 self.add_comment(key, formatted_comment)
 self.replace_label(issue, self.warning_label, self.done_label)
 self.unassign(key)
-
-def mark_stale_tickets_stale(self):
-
-stale_assigned_tickets = (
-f"project = FLINK AND resolution = Unresolved AND assignee is not 
EMPTY AND updated < "
-f"startOfDay(-{self.stale_days}d)"
-)
-logging.info(f"Looking for assigned tickets, which are stale.")
-issues = self.get_issues(stale_assigned_tickets)
-
-for issue in issues:
-key = issue["key"]
-issue = self.jira_client.get_issue(key)
-
-if not self.has_recently_updated_subtask(key, self.stale_days):
-logging.info(
-f"Found https://issues.apache.org/jira/browse/{key}. It is 
marked stale now."
-)
-formatted_comment = self.warning_comment.format(
-stale_days=self.stale_days,
-warning_days=self.warning_days,
-warning_label=self.warning_label,
-)
-
-self.add_label(issue, self.warning_label)
-self.add_comment(key, formatted_comment)
-
-else:
-logging.info(
-f"Found https://issues.apache.org/jira/browse/{key}, but 
is has recently updated Subtasks. "
-f"Ignoring for now."
-)
diff --git a/stale_major_or_above_rule.py b/stale_major_or_above_rule.py
index aeda3f1..e37c9d1 100644
--- a/stale_major_or_above_rule.py
+++ b/stale_major_or_above_rule.py
@@ -39,7 +39,10 @@ class StaleMajorOrAboveRule(FlinkJiraRule):
 
 def run(self):
 self.close_tickets_marked_stale()
-self.mark_stale_tickets_stale()
+self.mark_stale_tickets_stale(
+f"project=FLINK AND priority = {self.priority} AND resolution = 
Unresolved "
+f"AND assignee is empty AND updated < 
startOfDay(-{self.stale_days}d)"
+)
 
 def close_tickets_marked_stale(self):
 
@@ -67,35 +70,3 @@ class StaleMajorOrAboveRule(FlinkJiraRule):
 self.add_comment(key, formatted_comment)
 self.replace_label(issue, self.warning_label, self.done_label)
 self.set_priority(key, self.LOWER_PRIORITIES[self.priority])
-
- 

[flink-jira-bot] 18/47: [hotfix] fix tyop in Github Actions workflow

2021-05-19 Thread knaufk
This is an automated email from the ASF dual-hosted git repository.

knaufk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink-jira-bot.git

commit e575ac6695ea89176fb68e9526b5200be57afa2c
Author: Konstantin Knauf 
AuthorDate: Thu Apr 15 18:21:11 2021 +0200

[hotfix] fix tyop in Github Actions workflow
---
 .github/workflows/actions.yaml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.github/workflows/actions.yaml b/.github/workflows/actions.yaml
index d9ef9fe..1cc051b 100644
--- a/.github/workflows/actions.yaml
+++ b/.github/workflows/actions.yaml
@@ -1,4 +1,4 @@
-name: Run Flink Jira Twice Daily
+name: Run Flink Jira Bot Twice Daily
 
 on:
   schedule:


[flink-jira-bot] 44/47: Merge pull request #14 from knaufk/FLINK-22570

2021-05-19 Thread knaufk
This is an automated email from the ASF dual-hosted git repository.

knaufk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink-jira-bot.git

commit a43b94fbe084d9e9a6ddab4bfc7feba1f447300c
Merge: f185d86 7cccb04
Author: Konstantin Knauf 
AuthorDate: Wed May 19 10:07:44 2021 +0200

Merge pull request #14 from knaufk/FLINK-22570

[FLINK-22570] combine jira client calls and reduce number of notifica…

 flink_jira_rule.py   | 65 +++-
 stale_assigned_rule.py   | 25 +++--
 stale_major_or_above_rule.py | 20 --
 stale_minor_rule.py  | 22 +--
 4 files changed, 69 insertions(+), 63 deletions(-)


[flink-jira-bot] 24/47: [FLIINK-22034] update README.md for Rule1

2021-05-19 Thread knaufk
This is an automated email from the ASF dual-hosted git repository.

knaufk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink-jira-bot.git

commit 5ad9bd36bf13078c8d2ad1b87ca02da3ab9eb6c2
Author: Konstantin Knauf 
AuthorDate: Wed Apr 21 11:14:53 2021 +0200

[FLIINK-22034] update README.md for Rule1
---
 README.md | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/README.md b/README.md
index 503a762..a91e616 100644
--- a/README.md
+++ b/README.md
@@ -40,7 +40,12 @@ The configuration of the rules can be found in 
[config.yaml](config.yaml).
 
 ## About the Rules
 
-### Rule 1 (not implemented yet)
+### Rule 1 Major+ Need Assignee or Discussion
+
+Tickets major and above need an assignee, or an update within 
{stale_.stale_days}, otherwise the priority will be 
reduced after a warning period of {stale_.warning_days} 
days.
+An update of a Sub-Task counts as an update to the ticket. 
+Before this happens the assignee/reporter/watchers are notified that the 
ticket is about to become stale and will be deprioritized. 
+The time periods before warning differ based on the priority: 
 
 ### Rule 2: Unassign Stale Assigned Tickets
 


[flink-jira-bot] 17/47: Merge pull request #4 from knaufk/hotfix-jira

2021-05-19 Thread knaufk
This is an automated email from the ASF dual-hosted git repository.

knaufk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink-jira-bot.git

commit 93679d9fdd56cc6c0fd2850f08637bf5d8299a5e
Merge: 4cc0b90 310b9cc
Author: Konstantin Knauf 
AuthorDate: Wed Apr 14 19:42:56 2021 +0200

Merge pull request #4 from knaufk/hotfix-jira

[hotfix] fix runtime errors in flink_jira_bot.py

 flink_jira_bot.py | 34 ++
 1 file changed, 18 insertions(+), 16 deletions(-)


[flink-jira-bot] 14/47: [hotfix] fix name of github action

2021-05-19 Thread knaufk
This is an automated email from the ASF dual-hosted git repository.

knaufk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink-jira-bot.git

commit 4bd79cfa90fc4c323c7c09dd58d3e05001af6ba9
Author: Konstantin Knauf 
AuthorDate: Wed Apr 14 12:12:42 2021 +0200

[hotfix] fix name of github action
---
 .github/workflows/actions.yaml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.github/workflows/actions.yaml b/.github/workflows/actions.yaml
index 4af2e33..d9ef9fe 100644
--- a/.github/workflows/actions.yaml
+++ b/.github/workflows/actions.yaml
@@ -1,4 +1,4 @@
-name: Run Flink Jira Bot Hourly
+name: Run Flink Jira Twice Daily
 
 on:
   schedule:


[flink-jira-bot] 16/47: [hotfix] fix runtime errors & warnings in flink_jira_bot.py

2021-05-19 Thread knaufk
This is an automated email from the ASF dual-hosted git repository.

knaufk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink-jira-bot.git

commit 310b9cc2757e2ee41f0f82b1e0596f9b4cd71864
Author: Konstantin Knauf 
AuthorDate: Wed Apr 14 17:56:42 2021 +0200

[hotfix] fix runtime errors & warnings in flink_jira_bot.py
---
 flink_jira_bot.py | 34 ++
 1 file changed, 18 insertions(+), 16 deletions(-)

diff --git a/flink_jira_bot.py b/flink_jira_bot.py
index 72f13fe..f67e57e 100644
--- a/flink_jira_bot.py
+++ b/flink_jira_bot.py
@@ -21,7 +21,6 @@ import logging
 import confuse
 import os
 import abc
-import sys
 from argparse import ArgumentParser
 from pathlib import Path
 
@@ -47,7 +46,7 @@ class FlinkJiraRule:
 key = issue["key"]
 
 if not self.is_dry_run:
-self.jira.update_issue_field(key, fields)
+self.jira_client.update_issue_field(key, fields)
 else:
 logging.info(f'DRY RUN ({key}): Adding label "{label}".')
 
@@ -58,7 +57,7 @@ class FlinkJiraRule:
 key = issue["key"]
 
 if not self.is_dry_run:
-self.jira.update_issue_field(key, fields)
+self.jira_client.update_issue_field(key, fields)
 else:
 logging.info(
 f'DRY RUN ({key}): Replace label "{old_label}" for 
"{new_label}".'
@@ -66,13 +65,13 @@ class FlinkJiraRule:
 
 def add_comment(self, key, comment):
 if not self.is_dry_run:
-jira.issue_add_comment(key, comment)
+self.jira_client.issue_add_comment(key, comment)
 else:
 logging.info(f'DRY_RUN ({key}): Adding comment "{comment}".')
 
 def close_issue(self, key):
 if not self.is_dry_run:
-jira.issue_transition(key, "Closed")
+self.jira_client.issue_transition(key, "Closed")
 else:
 logging.info(f"DRY_RUN (({key})): Closing.")
 
@@ -88,6 +87,7 @@ class Rule3(FlinkJiraRule):
 self.warning_days = config["stale_minor"]["warning_days"].get()
 self.warning_label = config["stale_minor"]["warning_label"].get()
 self.done_label = config["stale_minor"]["done_label"].get()
+self.done_comment = config["stale_minor"]["done_comment"].get()
 self.warning_comment = config["stale_minor"]["warning_comment"].get()
 
 def run(self):
@@ -96,7 +96,10 @@ class Rule3(FlinkJiraRule):
 
 def close_tickets_marked_stale(self):
 
-minor_tickets_marked_stale = f'project=FLINK AND Priority = Minor AND 
resolution = Unresolved AND labels in ("{self.warning_label}") AND updated < 
startOfDay(-{self.warning_days}d)'
+minor_tickets_marked_stale = (
+f"project=FLINK AND Priority = Minor AND resolution = Unresolved 
AND labels in "
+f'("{self.warning_label}") AND updated < 
startOfDay(-{self.warning_days}d)'
+)
 logging.info(
 f"Looking for minor tickets, which were previously marked as 
stale: {minor_tickets_marked_stale}"
 )
@@ -120,7 +123,10 @@ class Rule3(FlinkJiraRule):
 
 def mark_stale_tickets_stale(self):
 
-stale_minor_tickets = f"project = FLINK AND Priority = Minor AND 
resolution = Unresolved AND updated < startOfDay(-{self.stale_days}d)"
+stale_minor_tickets = (
+f"project = FLINK AND Priority = Minor AND resolution = Unresolved 
AND updated < "
+f"startOfDay(-{self.stale_days}d)"
+)
 logging.info(
 f"Looking for minor tickets, which are stale: 
{stale_minor_tickets}"
 )
@@ -145,15 +151,11 @@ class Rule3(FlinkJiraRule):
 
 else:
 logging.info(
-f"Found https://issues.apache.org/jira/browse/{key}, but 
is has recently updated Subtasks. Ignoring for now."
+f"Found https://issues.apache.org/jira/browse/{key}, but 
is has recently updated Subtasks. "
+f"Ignoring for now."
 )
 
 
-def is_dry_run():
-opts = [opt for opt in sys.argv[1:] if opt.startswith("-")]
-return "-d" in opts
-
-
 def get_args():
 parser = ArgumentParser(description="Apache Flink Jira Bot")
 parser.add_argument(
@@ -179,8 +181,8 @@ if __name__ == "__main__":
 
 args = get_args()
 
-config = confuse.Configuration("flink-jira-bot", __name__)
-config.set_file(args.config)
+jira_bot_config = confuse.Configuration("flink-jira-bot", __name__)
+jira_bot_config.set_file(args.config)
 
 jira = Jira(
 url="https://issues.apache.org/jira;,
@@ -188,5 +190,5 @@ if __name__ == "__main__":
 password=os.environ["JIRA_PASSWORD"],
 )
 
-rule_3 = Rule3(jira, config, args.dryrun)
+rule_3 = Rule3(jira, jira_bot_config, args.dryrun)
 rule_3.run()


[flink-jira-bot] 25/47: [hotfix] give rule classes more descriptive names and refactor to separate files

2021-05-19 Thread knaufk
This is an automated email from the ASF dual-hosted git repository.

knaufk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink-jira-bot.git

commit 425f75f6f56e35e3fe91a7f2804c02e26fd895f3
Author: Konstantin Knauf 
AuthorDate: Wed Apr 21 11:16:15 2021 +0200

[hotfix] give rule classes more descriptive names and refactor to separate 
files
---
 .gitignore |   1 +
 flink_jira_bot.py  | 253 ++---
 flink_jira_rule.py | 103 
 stale_assigned_rule.py | 101 
 stale_minor_rule.py| 101 
 5 files changed, 312 insertions(+), 247 deletions(-)

diff --git a/.gitignore b/.gitignore
index 4b8ee1e..2d85626 100644
--- a/.gitignore
+++ b/.gitignore
@@ -17,3 +17,4 @@
 

 
 venv
+__pycache__
diff --git a/flink_jira_bot.py b/flink_jira_bot.py
index 8b46132..211f855 100644
--- a/flink_jira_bot.py
+++ b/flink_jira_bot.py
@@ -20,252 +20,11 @@ from atlassian import Jira
 import logging
 import confuse
 import os
-import abc
 from argparse import ArgumentParser
 from pathlib import Path
 
-
-class FlinkJiraRule:
-__metaclass__ = abc.ABCMeta
-
-def __init__(self, jira_client, config, is_dry_run):
-self.jira_client = jira_client
-self.config = config
-self.is_dry_run = is_dry_run
-
-def get_issues(self, jql_query):
-"""Queries the JIRA PI for all issues that match the given JQL Query
-
-This method is necessary as requests tend to time out if the number of 
results reaches a certain number.
-So, this method requests the results in multiple queries and returns a 
final list of all issues.
-:param jql_query: the search query
-:return: a list of issues matching the query
-"""
-limit = 200
-current = 0
-total = 1
-issues = []
-while current < total:
-response = self.jira_client.jql(jql_query, limit=limit, 
start=current)
-total = response["total"]
-issues = issues + response["issues"]
-current = len(issues)
-logging.info(f'"{jql_query}" returned {len(issues)} issues')
-return issues
-
-def has_recently_updated_subtask(self, parent, updated_within_days):
-find_subtasks_updated_within = (
-f"parent = {parent}  AND updated > 
startOfDay(-{updated_within_days}d)"
-)
-issues = self.get_issues(find_subtasks_updated_within)
-return len(issues) > 0
-
-def add_label(self, issue, label):
-labels = issue["fields"]["labels"] + [label]
-fields = {"labels": labels}
-key = issue["key"]
-
-if not self.is_dry_run:
-self.jira_client.update_issue_field(key, fields)
-else:
-logging.info(f'DRY RUN ({key}): Adding label "{label}".')
-
-def replace_label(self, issue, old_label, new_label):
-labels = issue["fields"]["labels"] + [new_label]
-labels.remove(old_label)
-fields = {"labels": labels}
-key = issue["key"]
-
-if not self.is_dry_run:
-self.jira_client.update_issue_field(key, fields)
-else:
-logging.info(
-f'DRY RUN ({key}): Replace label "{old_label}" for 
"{new_label}".'
-)
-
-def add_comment(self, key, comment):
-if not self.is_dry_run:
-self.jira_client.issue_add_comment(key, comment)
-else:
-logging.info(f'DRY_RUN ({key}): Adding comment "{comment}".')
-
-def close_issue(self, key):
-if not self.is_dry_run:
-self.jira_client.set_issue_status(
-key, "Closed", fields={"resolution": {"name": "Auto Closed"}}
-)
-else:
-logging.info(f"DRY_RUN (({key})): Closing.")
-
-def unassign(self, key):
-if not self.is_dry_run:
-self.jira_client.assign_issue(key, None)
-else:
-logging.info(f"DRY_RUN (({key})): Unassigning.")
-
-@abc.abstractmethod
-def run(self):
-return
-
-
-class Rule3(FlinkJiraRule):
-"""
-An unresolved Minor ticket without an update for {stale_minor.stale_days} 
is closed after a warning period of
-{stale_minor.warning_days} with a comment that encourages users to watch, 
comment and simply reopen with a higher
-priority if the problem insists.
-"""
-
-def __init__(self, jira_client, config, is_dry_run):
-super().__init__(jira_client, config, is_dry_run)
-self.stale_days = config["stale_minor"]["stale_days"].get()
-self.warning_days = config["stale_minor"]["warning_days"].get()
-self.warning_label = config["stale_minor"]["warning_label"].get()
-self.done_label = config["stale_minor"]["done_label"].get()
-self.done_comment = 

[flink-jira-bot] 22/47: [hotfix] Auto Close issues with resolution "Auto Closed" instead of "Fixed"

2021-05-19 Thread knaufk
This is an automated email from the ASF dual-hosted git repository.

knaufk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink-jira-bot.git

commit 5f209aeda78972c547e477751f235efffecbe545
Author: Konstantin Knauf 
AuthorDate: Wed Apr 21 11:03:49 2021 +0200

[hotfix] Auto Close issues with resolution "Auto Closed" instead of "Fixed"
---
 flink_jira_bot.py | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/flink_jira_bot.py b/flink_jira_bot.py
index 00ce80f..8b46132 100644
--- a/flink_jira_bot.py
+++ b/flink_jira_bot.py
@@ -91,7 +91,9 @@ class FlinkJiraRule:
 
 def close_issue(self, key):
 if not self.is_dry_run:
-self.jira_client.issue_transition(key, "Closed")
+self.jira_client.set_issue_status(
+key, "Closed", fields={"resolution": {"name": "Auto Closed"}}
+)
 else:
 logging.info(f"DRY_RUN (({key})): Closing.")
 
@@ -112,7 +114,7 @@ class Rule3(FlinkJiraRule):
 {stale_minor.warning_days} with a comment that encourages users to watch, 
comment and simply reopen with a higher
 priority if the problem insists.
 """
-
+
 def __init__(self, jira_client, config, is_dry_run):
 super().__init__(jira_client, config, is_dry_run)
 self.stale_days = config["stale_minor"]["stale_days"].get()


[flink-jira-bot] 31/47: Merge pull request #7 from knaufk/FLINK-22034

2021-05-19 Thread knaufk
This is an automated email from the ASF dual-hosted git repository.

knaufk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink-jira-bot.git

commit dfb2fd88a3625d059a03f2b310395b5a58c452e2
Merge: 1bd0618 3fcb3ff
Author: Konstantin Knauf 
AuthorDate: Thu Apr 22 11:06:05 2021 +0200

Merge pull request #7 from knaufk/FLINK-22034

[Flink-22034] Implement Rule 1 (and cleanup)

 .gitignore   |   1 +
 README.md|   7 +-
 config.yaml  |  23 
 flink_jira_bot.py| 268 ---
 flink_jira_rule.py   | 167 +++
 stale_assigned_rule.py   |  45 
 stale_major_or_above_rule.py |  49 
 stale_minor_rule.py  |  46 
 8 files changed, 358 insertions(+), 248 deletions(-)


[flink-jira-bot] 13/47: [hotfix] activate bot (remove dry-run flag)

2021-05-19 Thread knaufk
This is an automated email from the ASF dual-hosted git repository.

knaufk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink-jira-bot.git

commit 648787f08974abfcc1902b1b65ba25fcd6648c61
Author: Konstantin Knauf 
AuthorDate: Wed Apr 14 12:10:12 2021 +0200

[hotfix] activate bot (remove dry-run flag)
---
 .github/workflows/actions.yaml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/.github/workflows/actions.yaml b/.github/workflows/actions.yaml
index 0fc9681..4af2e33 100644
--- a/.github/workflows/actions.yaml
+++ b/.github/workflows/actions.yaml
@@ -2,7 +2,7 @@ name: Run Flink Jira Bot Hourly
 
 on:
   schedule:
-  - cron: 33 9,21 * * *
+  - cron: 33 10,22 * * *
 jobs:
   run:
 env:
@@ -22,4 +22,4 @@ jobs:
   pip install -r requirements.txt
   - name: Run Jira Bot
 run: |
-  python flink_jira_bot.py -d
\ No newline at end of file
+  python flink_jira_bot.py
\ No newline at end of file


[flink-jira-bot] 10/47: [FLINK-22035] add simply github action to run bot hourly

2021-05-19 Thread knaufk
This is an automated email from the ASF dual-hosted git repository.

knaufk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink-jira-bot.git

commit c20522941bf683d33f9d5fabfd8a1ab584f480b8
Author: Konstantin Knauf 
AuthorDate: Mon Apr 12 15:12:15 2021 +0200

[FLINK-22035] add simply github action to run bot hourly
---
 .github/workflows/actions.yaml | 25 +
 1 file changed, 25 insertions(+)

diff --git a/.github/workflows/actions.yaml b/.github/workflows/actions.yaml
new file mode 100644
index 000..b3dd688
--- /dev/null
+++ b/.github/workflows/actions.yaml
@@ -0,0 +1,25 @@
+name: Run Flink Jira Bot Hourly
+
+on:
+  schedule:
+  - cron: 0 * * * *
+jobs:
+  run:
+env:
+  JIRA_PASSWORD: ${{ secrets.FLINK_JIRA_BOT_PASSWORD }}
+
+runs-on: ubuntu-latest
+
+steps:
+  - uses: actions/checkout@v2
+  - name: Set up Python 3.9
+uses: actions/setup-python@v2
+with:
+  python-version: 3.9
+  - name: Install dependencies
+run: |
+  python -m pip install --upgrade pip
+  pip install -r requirements.txt
+  - name: Run Jira Bot
+run: |
+  python flink_jira_bot.py
\ No newline at end of file


[flink-jira-bot] 26/47: [FLINK-22034] add rule for stale major+ tickets

2021-05-19 Thread knaufk
This is an automated email from the ASF dual-hosted git repository.

knaufk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink-jira-bot.git

commit aa8c557fa1d1623b1c05d9c247fab2dd12a50533
Author: Konstantin Knauf 
AuthorDate: Wed Apr 21 13:16:15 2021 +0200

[FLINK-22034] add rule for stale major+ tickets
---
 config.yaml  |  23 ++
 flink_jira_bot.py|  13 ++
 flink_jira_rule.py   |   7 +++
 stale_major_or_above_rule.py | 107 +++
 4 files changed, 150 insertions(+)

diff --git a/config.yaml b/config.yaml
index d1cb3bb..d0e7aff 100644
--- a/config.yaml
+++ b/config.yaml
@@ -32,3 +32,26 @@ stale_minor:
 done_label: "auto-closed"
 done_comment: 'This issue has been labeled "{warning_label}" for 
{warning_days} days. It is closed now. If you are still affected by this or 
would like to raise the priority of this ticket please re-open, removing the 
label "{done_label}" and raise the ticket priority accordingly.'
 
+stale_blocker:
+stale_days: 1
+warning_days: 7
+warning_label: "stale-blocker"
+warning_comment: 'This Blockers is unassigned and itself and all of its 
Sub-Tasks have not been updated for {stale_days} days. So, it has been labeled 
"{warning_label}". If this ticket is a Blocker, please either assign yourself 
or give an update. Afterwards, please remove the label. In {warning_days} days 
the issue will be deprioritized.'
+done_label: "auto-deprioritized-blocker"
+done_comment: 'This issue has been labeled "{warning_label}" for 
{warning_days} days. It is deprioritized now. If this ticket is actually a 
Blocker, please raise the ticket priority again and assign yourself or revive 
the public discussion.'
+
+stale_critical:
+stale_days: 7
+warning_days: 7
+warning_label: "stale-critical"
+warning_comment: 'This critical issue is unassigned and itself and all of 
its Sub-Tasks have not been updated for {stale_days} days. So, it has been 
labeled "{warning_label}". If this ticket is indeed critical, please either 
assign yourself or give an update. Afterwards, please remove the label. In 
{warning_days} days the issue will be deprioritized.'
+done_label: "auto-deprioritized-critical"
+done_comment: 'This issue has been labeled "{warning_label}" for 
{warning_days} days. It is deprioritized now. If this ticket is actually 
critical, please raise the ticket priority again and assign yourself or revive 
the public discussion.'
+
+stale_major:
+stale_days: 30
+warning_days: 7
+warning_label: "stale-major"
+warning_comment: 'This major issue is unassigned and itself and all of its 
Sub-Tasks have not been updated for {stale_days} days. So, it has been labeled 
"{warning_label}". If this ticket is indeed "major", please either assign 
yourself or give an update. Afterwards, please remove the label. In 
{warning_days} days the issue will be deprioritized.'
+done_label: "auto-deprioritized-major"
+done_comment: 'This issue has been labeled "{warning_label}" for 
{warning_days} days. It is deprioritized now. If this ticket is actually 
"major", please raise the ticket priority again and assign yourself or revive 
the public discussion.'
diff --git a/flink_jira_bot.py b/flink_jira_bot.py
index 211f855..80a58e9 100644
--- a/flink_jira_bot.py
+++ b/flink_jira_bot.py
@@ -24,6 +24,7 @@ from argparse import ArgumentParser
 from pathlib import Path
 
 from stale_assigned_rule import StaleAssignedRule
+from stale_major_or_above_rule import StaleMajorOrAboveRule
 from stale_minor_rule import StaleMinorRule
 
 
@@ -63,5 +64,17 @@ if __name__ == "__main__":
 
 stale_assigned_rule = StaleAssignedRule(jira, jira_bot_config, args.dryrun)
 stale_minor_rule = StaleMinorRule(jira, jira_bot_config, args.dryrun)
+stale_major_rule = StaleMajorOrAboveRule(
+jira, jira_bot_config, args.dryrun, "Major"
+)
+stale_critical_rule = StaleMajorOrAboveRule(
+jira, jira_bot_config, args.dryrun, "Critical"
+)
+stale_blocker_rule = StaleMajorOrAboveRule(
+jira, jira_bot_config, args.dryrun, "Blocker"
+)
 stale_assigned_rule.run()
 stale_minor_rule.run()
+stale_major_rule.run()
+stale_critical_rule.run()
+stale_blocker_rule.run()
diff --git a/flink_jira_rule.py b/flink_jira_rule.py
index 9960aca..566fce7 100644
--- a/flink_jira_rule.py
+++ b/flink_jira_rule.py
@@ -98,6 +98,13 @@ class FlinkJiraRule:
 else:
 logging.info(f"DRY_RUN (({key})): Unassigning.")
 
+def set_priority(self, key, priority):
+if not self.is_dry_run:
+fields = {"priority": {"name": priority}}
+self.jira_client.update_issue_field(key, fields)
+else:
+logging.info(f"DRY_RUN (({key})): Setting to {priority}")
+
 @abc.abstractmethod
 def run(self):
 return
diff --git a/stale_major_or_above_rule.py 

[flink-jira-bot] 15/47: Merge pull request #3 from knaufk/activate-bot

2021-05-19 Thread knaufk
This is an automated email from the ASF dual-hosted git repository.

knaufk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink-jira-bot.git

commit 4cc0b90f655950c42dc06e4555631eb40ee51f42
Merge: 9afde47 4bd79cf
Author: Konstantin Knauf 
AuthorDate: Wed Apr 14 12:13:15 2021 +0200

Merge pull request #3 from knaufk/activate-bot

[hotfix] activate bot (remove dry-run flag)

 .github/workflows/actions.yaml | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)


[flink-jira-bot] 07/47: [FLINK-22032] add minimal README

2021-05-19 Thread knaufk
This is an automated email from the ASF dual-hosted git repository.

knaufk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink-jira-bot.git

commit 1709d0456fc50530f3b84dd7d2c4a29193b0aaec
Author: Konstantin Knauf 
AuthorDate: Fri Apr 9 14:23:23 2021 +0200

[FLINK-22032] add minimal README
---
 README.md | 55 +++
 1 file changed, 55 insertions(+)

diff --git a/README.md b/README.md
index e69de29..befa400 100644
--- a/README.md
+++ b/README.md
@@ -0,0 +1,55 @@
+# Apache Flink Jira Bot
+
+The Flink Jira enforces some of the rules outlined in [the Apache Flink 
Confluence](https://cwiki.apache.org/confluence/display/FLINK/Flink+Jira+Process).
+
+## Usage
+
+```
+./venv/bin/python3 flink_jira_bot.py --help
+usage: flink_jira_bot.py [-h] [-d] [-c CONFIG]
+
+Apache Flink Jira Bot
+
+optional arguments:
+  -h, --helpshow this help message and exit
+  -d, --dry-run no action on Jira, only logging
+  -c CONFIG, --config CONFIG
+path to config file (default: config.yaml)
+```
+
+There are also `make` targets for the important actions:
+
+### Run
+```
+make run
+```
+
+### Dry-Run
+
+The dry-run does not make any changes to the Apache Flink Jira, but instead 
only logs the actions it would do.
+
+```
+make dry-run
+```
+
+### Configuration
+
+Both `make run` and `make dry-run` look for the password of `flink-jira-bot` 
in an environment variable called `JIRA_PASSWORD`. 
+
+The configuration of the rules can be found in [config.yaml](config.yaml). 
+
+## About the Rules
+
+### Rule 1 (not implemented yet)
+
+### Rule 2 (not implemented yet)
+
+### Rule 3
+
+An unresolved Minor ticket without an update for {stale.minor.stale_days} is 
closed after a warning period of {stale.minor.warning_days} with a comment that 
encourages users to watch, comment and simply reopen with a higher priority if 
the problem insists.
+
+## About Apache Flink
+
+Apache Flink is an open source project of The Apache Software Foundation (ASF).
+
+Flink is distributed data processing framework with powerful stream and batch 
processing capabilities. Learn more about Flink at http://flink.apache.org/
\ No newline at end of file


[flink-jira-bot] 11/47: [FLINK-22035] change cron schedule to twice daily, not at the full hour

2021-05-19 Thread knaufk
This is an automated email from the ASF dual-hosted git repository.

knaufk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink-jira-bot.git

commit e5fbb1388e35f5731b642fe742887e5b36538a4b
Author: Konstantin Knauf 
AuthorDate: Wed Apr 14 11:19:52 2021 +0200

[FLINK-22035] change cron schedule to twice daily, not at the full hour
---
 .github/workflows/actions.yaml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/.github/workflows/actions.yaml b/.github/workflows/actions.yaml
index b3dd688..0fc9681 100644
--- a/.github/workflows/actions.yaml
+++ b/.github/workflows/actions.yaml
@@ -2,7 +2,7 @@ name: Run Flink Jira Bot Hourly
 
 on:
   schedule:
-  - cron: 0 * * * *
+  - cron: 33 9,21 * * *
 jobs:
   run:
 env:
@@ -22,4 +22,4 @@ jobs:
   pip install -r requirements.txt
   - name: Run Jira Bot
 run: |
-  python flink_jira_bot.py
\ No newline at end of file
+  python flink_jira_bot.py -d
\ No newline at end of file


[flink-jira-bot] 03/47: [FINK-22032] add freeze target to Makefile

2021-05-19 Thread knaufk
This is an automated email from the ASF dual-hosted git repository.

knaufk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink-jira-bot.git

commit bf4c4c1144ce3f9f7fca5cccb8ce05b8541efe28
Author: Konstantin Knauf 
AuthorDate: Fri Apr 9 11:34:34 2021 +0200

[FINK-22032] add freeze target to Makefile
---
 Makefile | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/Makefile b/Makefile
index a9c933b..40ca9f7 100644
--- a/Makefile
+++ b/Makefile
@@ -17,6 +17,9 @@ run: venv
 format: venv
./$(VENV)/bin/python3 -m black .
 
+freeze: venv
+   ./$(VENV)/bin/pip freeze > requirements.txt
+
 clean:
rm -rf $(VENV)
find . -type f -name '*.pyc' -delete


[flink-jira-bot] 06/47: [FLINK-22032] introduce dry-run mode and add actual actions to rule 3

2021-05-19 Thread knaufk
This is an automated email from the ASF dual-hosted git repository.

knaufk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink-jira-bot.git

commit 0561a81f9b9d7db4a277db1465090b97a0c21936
Author: Konstantin Knauf 
AuthorDate: Fri Apr 9 14:15:15 2021 +0200

[FLINK-22032] introduce dry-run mode and add actual actions to rule 3
---
 Makefile  |   6 
 config.yaml   |   6 ++--
 flink_jira_bot.py | 102 +-
 requirements.txt  |   4 ++-
 4 files changed, 106 insertions(+), 12 deletions(-)

diff --git a/Makefile b/Makefile
index 677c9cc..adfff3d 100644
--- a/Makefile
+++ b/Makefile
@@ -11,6 +11,12 @@ $(VENV)/bin/activate: requirements.txt
 # venv is a shortcut target
 venv: $(VENV)/bin/activate
 
+help: venv
+   ./$(VENV)/bin/python3 flink_jira_bot.py --help
+
+dry-run: venv
+   ./$(VENV)/bin/python3 flink_jira_bot.py -d
+
 run: venv
./$(VENV)/bin/python3 flink_jira_bot.py
 
diff --git a/config.yaml b/config.yaml
index d77f815..727da38 100644
--- a/config.yaml
+++ b/config.yaml
@@ -1,6 +1,8 @@
 stale_minor:
 stale_days: 180
 warning_days: 7
-label: "stale-minor"
-comment: 'This issue (and any of its Sub-Tasks) has not been updated for 
{stale_days} days. So, it has been labeled "{label}". If you are still affected 
by this bug or are still interested in this issue, please give an update and 
remove the label. In {warning_days} days the issue will be closed 
automatically.'
+warning_label: "stale-minor"
+warning_comment: 'This issue and all of its Sub-Tasks have not been 
updated for {stale_days} days. So, it has been labeled "{warning_label}". If 
you are still affected by this bug or are still interested in this issue, 
please give an update and remove the label. In {warning_days} days the issue 
will be closed automatically.'
+done_label: "auto-closed"
+done_comment: 'This issue has been labeled "{warning_label}" for 
{warning_days} days. It is closed now. If you are still affected by this or 
would like to raise the priority of this ticket please re-open, removing the 
label "{done_label}" and raise the ticket priority accordingly.'
 
diff --git a/flink_jira_bot.py b/flink_jira_bot.py
index a092399..05541ca 100644
--- a/flink_jira_bot.py
+++ b/flink_jira_bot.py
@@ -3,14 +3,18 @@ import logging
 import confuse
 import os
 import abc
+import sys
+from argparse import ArgumentParser
+from pathlib import Path
 
 
 class FlinkJiraRule:
 __metaclass__ = abc.ABCMeta
 
-def __init__(self, jira_client, config):
+def __init__(self, jira_client, config, is_dry_run):
 self.jira_client = jira_client
 self.config = config
+self.is_dry_run = is_dry_run
 
 def has_recently_updated_subtask(self, parent, updated_within_days):
 find_subtasks_updated_within = (
@@ -19,18 +23,54 @@ class FlinkJiraRule:
 issues = self.jira_client.jql(find_subtasks_updated_within, limit=1)
 return issues["total"] > 0
 
+def add_label(self, issue, label):
+labels = issue["fields"]["labels"] + [label]
+fields = {"labels": labels}
+key = issue["key"]
+
+if not self.is_dry_run:
+self.jira.update_issue_field(key, fields)
+else:
+logging.info(f'DRY RUN ({key}): Adding label "{label}".')
+
+def replace_label(self, issue, old_label, new_label):
+labels = issue["fields"]["labels"] + [new_label]
+labels.remove(old_label)
+fields = {"labels": labels}
+key = issue["key"]
+
+if not self.is_dry_run:
+self.jira.update_issue_field(key, fields)
+else:
+logging.info(
+f'DRY RUN ({key}): Replace label "{old_label}" for 
"{new_label}".'
+)
+
+def add_comment(self, key, comment):
+if not self.is_dry_run:
+jira.issue_add_comment(key, comment)
+else:
+logging.info(f'DRY_RUN ({key}): Adding comment "{comment}".')
+
+def close_issue(self, key):
+if not self.is_dry_run:
+jira.issue_transition(key, "Closed")
+else:
+logging.info(f"DRY_RUN (({key})): Closing.")
+
 @abc.abstractmethod
 def run(self):
 return
 
 
 class Rule3(FlinkJiraRule):
-def __init__(self, jira_client, config):
-super().__init__(jira_client, config)
+def __init__(self, jira_client, config, is_dry_run):
+super().__init__(jira_client, config, is_dry_run)
 self.stale_days = config["stale_minor"]["stale_days"].get()
 self.warning_days = config["stale_minor"]["warning_days"].get()
-self.label = config["stale_minor"]["label"].get()
-self.comment = config["stale_minor"]["comment"].get()
+self.warning_label = config["stale_minor"]["warning_label"].get()
+self.done_label = config["stale_minor"]["done_label"].get()
+self.warning_comment = 

[flink-jira-bot] 12/47: Merge pull request #2 from knaufk/FLINK-22035

2021-05-19 Thread knaufk
This is an automated email from the ASF dual-hosted git repository.

knaufk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink-jira-bot.git

commit 9afde4761b1d029c638a6067697a3523f179a588
Merge: ad9bbe7 e5fbb13
Author: Konstantin Knauf 
AuthorDate: Wed Apr 14 11:25:45 2021 +0200

Merge pull request #2 from knaufk/FLINK-22035

[FLINK-22035] Add Github Actions

 .github/workflows/actions.yaml | 25 +
 1 file changed, 25 insertions(+)


[flink-jira-bot] 21/47: Merge pull request #5 from knaufk/FLINK-22033

2021-05-19 Thread knaufk
This is an automated email from the ASF dual-hosted git repository.

knaufk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink-jira-bot.git

commit 8bf7d6a01ffaf4f2b4c3a47b82562f3e71614f82
Merge: 93679d9 77943a1
Author: Konstantin Knauf 
AuthorDate: Fri Apr 16 11:46:02 2021 +0200

Merge pull request #5 from knaufk/FLINK-22033

[FLINK-22033] Implementation of Rule 2

 .github/workflows/actions.yaml |   2 +-
 README.md  |   8 ++-
 config.yaml|   8 +++
 flink_jira_bot.py  | 128 ++---
 4 files changed, 134 insertions(+), 12 deletions(-)


[flink-jira-bot] 08/47: [FLINK-22023] add license headers

2021-05-19 Thread knaufk
This is an automated email from the ASF dual-hosted git repository.

knaufk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink-jira-bot.git

commit 3cfda47472ddf6c4efe449b333637a0e578c7593
Author: Konstantin Knauf 
AuthorDate: Fri Apr 9 14:34:48 2021 +0200

[FLINK-22023] add license headers
---
 .gitignore| 18 ++
 Makefile  | 19 +++
 config.yaml   | 18 ++
 flink_jira_bot.py | 18 ++
 requirements.txt  | 18 ++
 5 files changed, 91 insertions(+)

diff --git a/.gitignore b/.gitignore
index 5ceb386..4b8ee1e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,19 @@
+
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF 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.
+
+
 venv
diff --git a/Makefile b/Makefile
index adfff3d..7e2cc73 100644
--- a/Makefile
+++ b/Makefile
@@ -1,3 +1,22 @@
+
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF 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.
+
+
+
 # define the name of the virtual environment directory
 VENV := venv
 
diff --git a/config.yaml b/config.yaml
index 727da38..1afae72 100644
--- a/config.yaml
+++ b/config.yaml
@@ -1,3 +1,21 @@
+
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF 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.
+
+
 stale_minor:
 stale_days: 180
 warning_days: 7
diff --git a/flink_jira_bot.py b/flink_jira_bot.py
index 05541ca..72f13fe 100644
--- a/flink_jira_bot.py
+++ b/flink_jira_bot.py
@@ -1,3 +1,21 @@
+
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF 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 

[flink-jira-bot] 05/47: [FLINK-22032] add Rule 3 (logging only)

2021-05-19 Thread knaufk
This is an automated email from the ASF dual-hosted git repository.

knaufk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink-jira-bot.git

commit 6f4e13c295cd09789d509db49496956751e7d9cd
Author: Konstantin Knauf 
AuthorDate: Fri Apr 9 13:42:42 2021 +0200

[FLINK-22032] add Rule 3 (logging only)
---
 Makefile  |  2 +-
 README.md |  0
 config.yaml   |  6 
 flink_jira_bot.py | 90 +++
 4 files changed, 97 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 40ca9f7..677c9cc 100644
--- a/Makefile
+++ b/Makefile
@@ -12,7 +12,7 @@ $(VENV)/bin/activate: requirements.txt
 venv: $(VENV)/bin/activate
 
 run: venv
-   ./$(VENV)/bin/python3 flink_jira_bot/flink_jira_bot.py
+   ./$(VENV)/bin/python3 flink_jira_bot.py
 
 format: venv
./$(VENV)/bin/python3 -m black .
diff --git a/README.md b/README.md
new file mode 100644
index 000..e69de29
diff --git a/config.yaml b/config.yaml
new file mode 100644
index 000..d77f815
--- /dev/null
+++ b/config.yaml
@@ -0,0 +1,6 @@
+stale_minor:
+stale_days: 180
+warning_days: 7
+label: "stale-minor"
+comment: 'This issue (and any of its Sub-Tasks) has not been updated for 
{stale_days} days. So, it has been labeled "{label}". If you are still affected 
by this bug or are still interested in this issue, please give an update and 
remove the label. In {warning_days} days the issue will be closed 
automatically.'
+
diff --git a/flink_jira_bot.py b/flink_jira_bot.py
new file mode 100644
index 000..a092399
--- /dev/null
+++ b/flink_jira_bot.py
@@ -0,0 +1,90 @@
+from atlassian import Jira
+import logging
+import confuse
+import os
+import abc
+
+
+class FlinkJiraRule:
+__metaclass__ = abc.ABCMeta
+
+def __init__(self, jira_client, config):
+self.jira_client = jira_client
+self.config = config
+
+def has_recently_updated_subtask(self, parent, updated_within_days):
+find_subtasks_updated_within = (
+f"parent = {parent}  AND updated > 
startOfDay(-{updated_within_days}d)"
+)
+issues = self.jira_client.jql(find_subtasks_updated_within, limit=1)
+return issues["total"] > 0
+
+@abc.abstractmethod
+def run(self):
+return
+
+
+class Rule3(FlinkJiraRule):
+def __init__(self, jira_client, config):
+super().__init__(jira_client, config)
+self.stale_days = config["stale_minor"]["stale_days"].get()
+self.warning_days = config["stale_minor"]["warning_days"].get()
+self.label = config["stale_minor"]["label"].get()
+self.comment = config["stale_minor"]["comment"].get()
+
+def run(self):
+self.close_tickets_marked_stale()
+self.mark_stale_tickets_stale()
+
+def close_tickets_marked_stale(self):
+
+minor_tickets_marked_stale = f'project=FLINK AND Priority = Minor AND 
resolution = Unresolved AND labels in ("{self.label}") AND updated < 
startOfDay(-{self.warning_days}d)'
+logging.info(
+f"Looking for minor tickets, which were previously marked as 
stale: {minor_tickets_marked_stale}"
+)
+issues = jira.jql(minor_tickets_marked_stale, limit=1)
+
+for issue in issues["issues"]:
+key = issue["key"]
+logging.info(
+f"Found https://issues.apache.org/jira/browse/{key}. It is now 
closed due to inactivity."
+)
+
+def mark_stale_tickets_stale(self):
+
+stale_minor_tickets = f"project = FLINK AND Priority = Minor AND 
resolution = Unresolved AND updated < startOfDay(-{self.stale_days}d)"
+logging.info(
+f"Looking for minor tickets, which are stale: 
{stale_minor_tickets}"
+)
+issues = self.jira_client.jql(stale_minor_tickets, limit=1)
+
+for issue in issues["issues"]:
+key = issue["key"]
+issue = self.jira_client.get_issue(key)
+
+if not self.has_recently_updated_subtask(key, self.stale_days):
+logging.info(
+f"Found https://issues.apache.org/jira/browse/{key}. It is 
marked stale now."
+)
+
+else:
+logging.debug(
+f"Found https://issues.apache.org/jira/browse/{key}, but 
is has recently updated Subtasks. Ignoring for now."
+)
+
+
+if __name__ == "__main__":
+
+logging.getLogger().setLevel(logging.INFO)
+
+config = confuse.Configuration("flink-jira-bot", __name__)
+config.set_file("config.yaml")
+
+jira = Jira(
+url="https://issues.apache.org/jira;,
+username="flink-jira-bot",
+password=os.environ["JIRA_PASSWORD"],
+)
+
+rule_3 = Rule3(jira, config)
+rule_3.run()


[flink-jira-bot] 09/47: Merge pull request #1 from knaufk/FLINK-22032

2021-05-19 Thread knaufk
This is an automated email from the ASF dual-hosted git repository.

knaufk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink-jira-bot.git

commit ad9bbe7575797603b95e63ccfecfa13f4d68dac0
Merge: 647197b 3cfda47
Author: Konstantin Knauf 
AuthorDate: Mon Apr 12 18:02:41 2021 +0200

Merge pull request #1 from knaufk/FLINK-22032

[Flink-22032] Adding Bot with Initial Rule

 .gitignore|  19 ++
 Makefile  |  54 +++
 README.md |  55 
 config.yaml   |  26 
 flink_jira_bot.py | 192 ++
 requirements.txt  |  41 
 6 files changed, 387 insertions(+)


[flink-jira-bot] 01/47: Initial commit with the ASL

2021-05-19 Thread knaufk
This is an automated email from the ASF dual-hosted git repository.

knaufk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink-jira-bot.git

commit 647197b3f5c1ab663fd81db383d39fc537553437
Author: Robert Metzger 
AuthorDate: Wed Apr 7 20:40:13 2021 +0200

Initial commit with the ASL
---
 LICENSE | 201 
 1 file changed, 201 insertions(+)

diff --git a/LICENSE b/LICENSE
new file mode 100644
index 000..261eeb9
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,201 @@
+ Apache License
+   Version 2.0, January 2004
+http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+  "License" shall mean the terms and conditions for use, reproduction,
+  and distribution as defined by Sections 1 through 9 of this document.
+
+  "Licensor" shall mean the copyright owner or entity authorized by
+  the copyright owner that is granting the License.
+
+  "Legal Entity" shall mean the union of the acting entity and all
+  other entities that control, are controlled by, or are under common
+  control with that entity. For the purposes of this definition,
+  "control" means (i) the power, direct or indirect, to cause the
+  direction or management of such entity, whether by contract or
+  otherwise, or (ii) ownership of fifty percent (50%) or more of the
+  outstanding shares, or (iii) beneficial ownership of such entity.
+
+  "You" (or "Your") shall mean an individual or Legal Entity
+  exercising permissions granted by this License.
+
+  "Source" form shall mean the preferred form for making modifications,
+  including but not limited to software source code, documentation
+  source, and configuration files.
+
+  "Object" form shall mean any form resulting from mechanical
+  transformation or translation of a Source form, including but
+  not limited to compiled object code, generated documentation,
+  and conversions to other media types.
+
+  "Work" shall mean the work of authorship, whether in Source or
+  Object form, made available under the License, as indicated by a
+  copyright notice that is included in or attached to the work
+  (an example is provided in the Appendix below).
+
+  "Derivative Works" shall mean any work, whether in Source or Object
+  form, that is based on (or derived from) the Work and for which the
+  editorial revisions, annotations, elaborations, or other modifications
+  represent, as a whole, an original work of authorship. For the purposes
+  of this License, Derivative Works shall not include works that remain
+  separable from, or merely link (or bind by name) to the interfaces of,
+  the Work and Derivative Works thereof.
+
+  "Contribution" shall mean any work of authorship, including
+  the original version of the Work and any modifications or additions
+  to that Work or Derivative Works thereof, that is intentionally
+  submitted to Licensor for inclusion in the Work by the copyright owner
+  or by an individual or Legal Entity authorized to submit on behalf of
+  the copyright owner. For the purposes of this definition, "submitted"
+  means any form of electronic, verbal, or written communication sent
+  to the Licensor or its representatives, including but not limited to
+  communication on electronic mailing lists, source code control systems,
+  and issue tracking systems that are managed by, or on behalf of, the
+  Licensor for the purpose of discussing and improving the Work, but
+  excluding communication that is conspicuously marked or otherwise
+  designated in writing by the copyright owner as "Not a Contribution."
+
+  "Contributor" shall mean Licensor and any individual or Legal Entity
+  on behalf of whom a Contribution has been received by Licensor and
+  subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+  this License, each Contributor hereby grants to You a perpetual,
+  worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+  copyright license to reproduce, prepare Derivative Works of,
+  publicly display, publicly perform, sublicense, and distribute the
+  Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+  this License, each Contributor hereby grants to You a perpetual,
+  worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+  (except as stated in this section) patent license to make, have made,
+  use, offer to sell, sell, import, and otherwise transfer the Work,
+  where such license applies only to those patent claims licensable
+   

[flink-jira-bot] 04/47: [FLINK-22032] add confuse for YAML configuration parsing

2021-05-19 Thread knaufk
This is an automated email from the ASF dual-hosted git repository.

knaufk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink-jira-bot.git

commit c343d837f21aec32cf9696be3db1308c8de70c88
Author: Konstantin Knauf 
AuthorDate: Fri Apr 9 11:34:48 2021 +0200

[FLINK-22032] add confuse for YAML configuration parsing
---
 requirements.txt | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/requirements.txt b/requirements.txt
index d058698..c5e1dd1 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -4,12 +4,14 @@ black @ 
git+git://github.com/psf/black@e114ef5514e95cb9908b38c2397978f2070c1b0e
 certifi==2020.12.5
 chardet==4.0.0
 click==7.1.2
+confuse==1.4.0
 Deprecated==1.2.12
 idna==2.10
 mypy-extensions==0.4.3
 oauthlib==3.1.0
 pathspec==0.8.1
 pycparser==2.20
+PyYAML==5.4.1
 regex==2021.4.4
 requests==2.25.1
 requests-oauthlib==1.3.0


[flink-jira-bot] 02/47: [FLINK-22032] add Makefile and requirements.txt

2021-05-19 Thread knaufk
This is an automated email from the ASF dual-hosted git repository.

knaufk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink-jira-bot.git

commit f5aa96e9fddf0607471fc587147db6e7037a198c
Author: Konstantin Knauf 
AuthorDate: Fri Apr 9 11:30:03 2021 +0200

[FLINK-22032] add Makefile and requirements.txt
---
 .gitignore   |  1 +
 Makefile | 26 ++
 requirements.txt | 19 +++
 3 files changed, 46 insertions(+)

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 000..5ceb386
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+venv
diff --git a/Makefile b/Makefile
new file mode 100644
index 000..a9c933b
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,26 @@
+# define the name of the virtual environment directory
+VENV := venv
+
+# default target, when make executed without arguments
+all: venv
+
+$(VENV)/bin/activate: requirements.txt
+   python3 -m venv $(VENV)
+   ./$(VENV)/bin/pip install -r requirements.txt
+
+# venv is a shortcut target
+venv: $(VENV)/bin/activate
+
+run: venv
+   ./$(VENV)/bin/python3 flink_jira_bot/flink_jira_bot.py
+
+format: venv
+   ./$(VENV)/bin/python3 -m black .
+
+clean:
+   rm -rf $(VENV)
+   find . -type f -name '*.pyc' -delete
+
+
+
+.PHONY: all venv run clean
\ No newline at end of file
diff --git a/requirements.txt b/requirements.txt
new file mode 100644
index 000..d058698
--- /dev/null
+++ b/requirements.txt
@@ -0,0 +1,19 @@
+appdirs==1.4.4
+atlassian-python-api==3.8.0
+black @ git+git://github.com/psf/black@e114ef5514e95cb9908b38c2397978f2070c1b0e
+certifi==2020.12.5
+chardet==4.0.0
+click==7.1.2
+Deprecated==1.2.12
+idna==2.10
+mypy-extensions==0.4.3
+oauthlib==3.1.0
+pathspec==0.8.1
+pycparser==2.20
+regex==2021.4.4
+requests==2.25.1
+requests-oauthlib==1.3.0
+six==1.15.0
+toml==0.10.2
+urllib3==1.26.4
+wrapt==1.12.1


[flink-jira-bot] branch master updated (a43b94f -> dcb4a44)

2021-05-19 Thread knaufk
This is an automated email from the ASF dual-hosted git repository.

knaufk pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/flink-jira-bot.git.


from a43b94f  Merge pull request #14 from knaufk/FLINK-22570
 new 9c2998a  [hotfix] fix typo in one of the comments
 new 59c16f5  [FLINK-22569] limit number of tickets touched by the bot per 
run to 100
 new dcb4a44  Merge pull request #15 from knaufk/FLINK-22569

The 47 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 config.yaml|  7 ++-
 flink_jira_rule.py | 17 +
 2 files changed, 15 insertions(+), 9 deletions(-)


[flink-jira-bot] branch master updated: [FLINK-22570] combine jira client calls and reduce number of notifications to one per ticket per rule

2021-05-19 Thread knaufk
This is an automated email from the ASF dual-hosted git repository.

knaufk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink-jira-bot.git


The following commit(s) were added to refs/heads/master by this push:
 new 7cccb04  [FLINK-22570] combine jira client calls and reduce number of 
notifications to one per ticket per rule
 new a43b94f  Merge pull request #14 from knaufk/FLINK-22570
7cccb04 is described below

commit 7cccb045fb9a53d1e8d5b72a644099b0a90bc08d
Author: Konstantin Knauf 
AuthorDate: Tue May 18 19:03:50 2021 +0200

[FLINK-22570] combine jira client calls and reduce number of notifications 
to one per ticket per rule
---
 flink_jira_rule.py   | 65 +++-
 stale_assigned_rule.py   | 25 +++--
 stale_major_or_above_rule.py | 20 --
 stale_minor_rule.py  | 22 +--
 4 files changed, 69 insertions(+), 63 deletions(-)

diff --git a/flink_jira_rule.py b/flink_jira_rule.py
index a98ca71..3f784d7 100644
--- a/flink_jira_rule.py
+++ b/flink_jira_rule.py
@@ -60,58 +60,14 @@ class FlinkJiraRule:
 issues = self.get_issues(find_subtasks_updated_within)
 return len(issues) > 0
 
-def add_label(self, issue, label):
-labels = issue["fields"]["labels"] + [label]
-fields = {"labels": labels}
-key = issue["key"]
-
-if not self.is_dry_run:
-self.jira_client.update_issue_field(key, fields)
-else:
-logging.info(f'DRY RUN ({key}): Adding label "{label}".')
-
-def replace_label(self, issue, old_label, new_label):
-labels = issue["fields"]["labels"] + [new_label]
-labels.remove(old_label)
-fields = {"labels": labels}
-key = issue["key"]
-
-if not self.is_dry_run:
-self.jira_client.update_issue_field(key, fields)
-else:
-logging.info(
-f'DRY RUN ({key}): Replace label "{old_label}" for 
"{new_label}".'
-)
-
-def add_comment(self, key, comment):
+def add_label_with_comment(self, key, label, comment):
 if not self.is_dry_run:
-self.jira_client.issue_add_comment(key, comment)
-else:
-logging.info(f'DRY_RUN ({key}): Adding comment "{comment}".')
-
-def close_issue(self, key):
-if not self.is_dry_run:
-self.jira_client.set_issue_status(
-key, "Closed", fields={"resolution": {"name": "Auto Closed"}}
+self.jira_client.edit_issue(
+key,
+{"labels": [{"add": label}], "comment": [{"add": {"body": 
comment}}]},
 )
 else:
-logging.info(f"DRY_RUN (({key})): Closing.")
-
-def unassign(self, key):
-if not self.is_dry_run:
-if self.jira_client.get_issue_status(key) == "In Progress":
-self.jira_client.assign_issue(key, self.jira_client.username)
-self.jira_client.set_issue_status(key, "Open")
-self.jira_client.assign_issue(key, None)
-else:
-logging.info(f"DRY_RUN (({key})): Unassigning.")
-
-def set_priority(self, key, priority):
-if not self.is_dry_run:
-fields = {"priority": {"name": priority}}
-self.jira_client.update_issue_field(key, fields)
-else:
-logging.info(f"DRY_RUN (({key})): Setting to {priority}")
+logging.info(f'DRY RUN ({key}): Adding label "{label}".')
 
 @abc.abstractmethod
 def run(self):
@@ -140,12 +96,11 @@ class FlinkJiraRule:
 warning_label=self.warning_label,
 )
 
-self.add_label(issue, self.warning_label)
-self.add_comment(key, formatted_comment)
+self.add_label_with_comment(key, self.warning_label, 
formatted_comment)
 
 else:
 logging.info(
-f"Found https://issues.apache.org/jira/browse/{key}, but 
is has recently updated Subtasks. "
+f"Found https://issues.apache.org/jira/browse/{key}, but 
is has recently updated Subtasks."
 f"Ignoring for now."
 )
 
@@ -165,6 +120,6 @@ class FlinkJiraRule:
 done_label=self.done_label,
 )
 
-self.add_comment(key, formatted_comment)
-self.replace_label(issue, self.warning_label, self.done_label)
-self.handle_stale_ticket(key)
+self.handle_stale_ticket(
+key, self.warning_label, self.done_label, formatted_comment
+)
diff --git a/stale_assigned_rule.py b/stale_assigned_rule.py
index 26c7b00..d5cb41c 100644
--- a/stale_assigned_rule.py
+++ b/stale_assigned_rule.py
@@ -41,5 +41,26 @@ class StaleAssignedRule(FlinkJiraRule):
 f"AND updated < startOfDay(-{self.stale_days}d)"
 )
 
-def handle_stale_ticket(self, key):
-

[flink-statefun] branch master updated: [FLINK-22552] Update Flink dependency to 1.13.0

2021-05-19 Thread tzulitai
This is an automated email from the ASF dual-hosted git repository.

tzulitai pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink-statefun.git


The following commit(s) were added to refs/heads/master by this push:
 new 3e7da0c  [FLINK-22552] Update Flink dependency to 1.13.0
3e7da0c is described below

commit 3e7da0c5bf7ebc796e5498f859767c93cf007e56
Author: Tzu-Li (Gordon) Tai 
AuthorDate: Tue May 18 14:15:03 2021 +0800

[FLINK-22552] Update Flink dependency to 1.13.0

This closes #234.
---
 pom.xml|  2 +-
 statefun-flink/statefun-flink-common/pom.xml   |  2 +-
 .../flink/statefun/flink/core/functions/ReductionsTest.java| 10 --
 .../flink/launcher/StatefulFunctionsClusterEntryPoint.java |  5 +++--
 tools/docker/Dockerfile|  4 +---
 5 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/pom.xml b/pom.xml
index 44e8360..f85922b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -76,7 +76,7 @@ under the License.
 3.7.1
 2.3.2
 
3.11.1
-1.12.1
+1.13.0
 2.12
 ${rootDir}
 
diff --git a/statefun-flink/statefun-flink-common/pom.xml 
b/statefun-flink/statefun-flink-common/pom.xml
index ac96bef..fedbddb 100644
--- a/statefun-flink/statefun-flink-common/pom.xml
+++ b/statefun-flink/statefun-flink-common/pom.xml
@@ -49,7 +49,7 @@ under the License.
 
 org.apache.flink
 flink-shaded-jackson
-2.10.1-12.0
+2.12.1-13.0
 
 
 
diff --git 
a/statefun-flink/statefun-flink-core/src/test/java/org/apache/flink/statefun/flink/core/functions/ReductionsTest.java
 
b/statefun-flink/statefun-flink-core/src/test/java/org/apache/flink/statefun/flink/core/functions/ReductionsTest.java
index ab2a8f7..3f84bce 100644
--- 
a/statefun-flink/statefun-flink-core/src/test/java/org/apache/flink/statefun/flink/core/functions/ReductionsTest.java
+++ 
b/statefun-flink/statefun-flink-core/src/test/java/org/apache/flink/statefun/flink/core/functions/ReductionsTest.java
@@ -31,6 +31,7 @@ import java.util.Set;
 import java.util.stream.Stream;
 import javax.annotation.Nonnull;
 import org.apache.flink.api.common.ExecutionConfig;
+import org.apache.flink.api.common.JobID;
 import org.apache.flink.api.common.accumulators.Accumulator;
 import org.apache.flink.api.common.accumulators.DoubleCounter;
 import org.apache.flink.api.common.accumulators.Histogram;
@@ -302,6 +303,11 @@ public class ReductionsTest {
 public void registerUserCodeClassLoaderReleaseHookIfAbsent(String s, 
Runnable runnable) {
   throw new UnsupportedOperationException();
 }
+
+@Override
+public JobID getJobId() {
+  throw new UnsupportedOperationException();
+}
   }
 
   private static final class FakeKeyedStateBackend implements 
KeyedStateBackend {
@@ -352,9 +358,9 @@ public class ReductionsTest {
 
 @Nonnull
 @Override
-public 
+public  
& Keyed>
 KeyGroupedInternalPriorityQueue create(
-@Nonnull String stateName, @Nonnull TypeSerializer 
byteOrderedElementSerializer) {
+@Nonnull String s, @Nonnull TypeSerializer typeSerializer) {
   throw new UnsupportedOperationException();
 }
 
diff --git 
a/statefun-flink/statefun-flink-launcher/src/main/java/org/apache/flink/statefun/flink/launcher/StatefulFunctionsClusterEntryPoint.java
 
b/statefun-flink/statefun-flink-launcher/src/main/java/org/apache/flink/statefun/flink/launcher/StatefulFunctionsClusterEntryPoint.java
index ae8a74b..45188fd 100644
--- 
a/statefun-flink/statefun-flink-launcher/src/main/java/org/apache/flink/statefun/flink/launcher/StatefulFunctionsClusterEntryPoint.java
+++ 
b/statefun-flink/statefun-flink-launcher/src/main/java/org/apache/flink/statefun/flink/launcher/StatefulFunctionsClusterEntryPoint.java
@@ -119,12 +119,13 @@ public final class StatefulFunctionsClusterEntryPoint 
extends JobClusterEntrypoi
 if (isNoExecutionModeConfigured(configuration)) {
   // In contrast to other places, the default for standalone job clusters 
is
   // ExecutionMode.DETACHED
-  configuration.setString(ClusterEntrypoint.EXECUTION_MODE, 
ExecutionMode.DETACHED.toString());
+  configuration.setString(
+  ClusterEntrypoint.INTERNAL_CLUSTER_EXECUTION_MODE, 
ExecutionMode.DETACHED.toString());
 }
   }
 
   private static boolean isNoExecutionModeConfigured(Configuration 
configuration) {
-return configuration.getString(ClusterEntrypoint.EXECUTION_MODE, null) == 
null;
+return 
configuration.getString(ClusterEntrypoint.INTERNAL_CLUSTER_EXECUTION_MODE, 
null) == null;
   }
 
   private static void addStatefulFunctionsConfiguration(Configuration 
configuration) {
diff --git a/tools/docker/Dockerfile b/tools/docker/Dockerfile
index 155755d..02a0b0f 100644
--- a/tools/docker/Dockerfile
+++ b/tools/docker/Dockerfile