Skip to content

Commit ec23172

Browse files
authored
Fix table printing to always display results regardless of gate conditions (#1)
1 parent 974d9f9 commit ec23172

File tree

8 files changed

+43
-26
lines changed

8 files changed

+43
-26
lines changed

.github/workflows/build.yaml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@ jobs:
66
build:
77
runs-on: ubuntu-latest
88
steps:
9-
- uses: actions/checkout@v2
10-
- name: Set up JDK 1.8
11-
uses: actions/setup-java@v1
9+
- uses: actions/checkout@v4
10+
- name: Set up JDK 22
11+
uses: actions/setup-java@v4
1212
with:
13-
java-version: 1.8
13+
java-version: 22
14+
distribution: 'temurin'
1415
- name: Build with Gradle
1516
run: ./gradlew clean build -P pluginVersion=test --info --stacktrace
1617

.github/workflows/release.yaml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,15 @@ jobs:
99
name: "Tagged Release Final"
1010
runs-on: "ubuntu-latest"
1111
steps:
12-
- uses: actions/checkout@v2
13-
- name: Set up JDK 1.8
14-
uses: actions/setup-java@v1
12+
- uses: actions/checkout@v4
13+
- name: Set up JDK 22
14+
uses: actions/setup-java@v4
1515
with:
16-
java-version: 1.8
16+
java-version: 22
17+
distribution: 'temurin'
1718
- name: Build with Gradle
1819
run: ./gradlew clean build --info --stacktrace
19-
- uses: "marvinpinto/action-automatic-releases@latest"
20+
- uses: softprops/action-gh-release@v2
2021
with:
21-
repo_token: "${{ secrets.GITHUB_TOKEN }}"
22-
prerelease: false
2322
files: |
2423
./build/libs/xlr-advanced-gating-plugin-*.*

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2021 Digital.ai customers
3+
Copyright (c) 2025 Digital.ai customers
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
plugins {
2-
id 'org.ajoberstar.grgit' version '4.0.0'
2+
id 'org.ajoberstar.grgit' version '5.3.2'
33
id 'java'
44
}
55

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6-bin.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-9.0.0-bin.zip

src/main/resources/advancedGating/Gate.py

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright 2021 Digital.ai
2+
# Copyright 2025 Digital.ai
33
#
44
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
55
#
@@ -14,14 +14,31 @@
1414
else:
1515
gatePassed = any(results)
1616

17-
if not useOutput and not gatePassed:
18-
raise Exception("Gate failed with results list: {}".format(results))
17+
# Print dedicated success or failure message
18+
if gatePassed:
19+
print("Gate passed successfully!")
20+
else:
21+
failed_count = len([r for r in results if not r])
22+
if failed_count == 1:
23+
print("Gate failed! 1 condition was not satisfied.")
24+
else:
25+
print("Gate failed! {} conditions were not satisfied.".format(failed_count))
1926

2027
table = u"""
2128
|Condition|Result|
22-
|---|---|
29+
|:------|:------:|
2330
"""
2431
for index, condition in enumerate(conditions.keys()):
2532
result = u"\u2714" if results[index] else u"\u2717"
26-
table += u"|{}|{}|\n".format(unicode(condition, "utf-8") + u"     ", result)
27-
print(table)
33+
# Handle both Python 2 and 3 compatibility for unicode
34+
try:
35+
condition_text = unicode(condition, "utf-8")
36+
except NameError:
37+
# Python 3 - unicode is str
38+
condition_text = str(condition)
39+
table += u"|{}|{}|\n".format(condition_text + u"     ", result)
40+
print(table)
41+
print(" ")
42+
43+
if not useOutput and not gatePassed:
44+
raise Exception("Gate failed")

src/main/resources/advancedGating/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright 2021 Digital.ai
2+
# Copyright 2025 Digital.ai
33
#
44
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
55
#

src/main/resources/synthetic.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version='1.0' encoding='UTF-8'?>
2-
<!-- Copyright 2021 Digital.ai
2+
<!-- Copyright 2025 Digital.ai
33
44
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
55
@@ -12,14 +12,14 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
1212
<type type="advancedGating.Gate" extends="xlrelease.PythonScript" label="Advanced Gating: Gate">
1313
<property name="iconLocation" category="input" hidden="true" default="advancedGating/AdvancedGating.png"/>
1414
<property name="taskColor" category="input" hidden="true" default="#CC4A3C"/>
15-
<property name="conditions" category="input" kind="map_string_string" description="Condition names and conditional expressions"/>
16-
<property name="conditionsType" category="input" kind="enum" default="AND" description="Pass this task if all of the criteria pass (AND) or any of the criteria pass (OR)">
15+
<property name="conditions" category="input" kind="map_string_string" description="Map of condition names to their evaluation expressions. Examples: Passed Compliance - ${passedCompliance}, Low Risk Prediction - ${riskPrediction} &lt; 0.1"/>
16+
<property name="conditionsType" category="input" kind="enum" default="AND" description="Determines if all conditions must pass (AND) or any condition can pass (OR)">
1717
<enum-values>
1818
<value>AND</value>
1919
<value>OR</value>
2020
</enum-values>
2121
</property>
22-
<property name="useOutput" category="input" kind="boolean" description="Complete this task, regardless of whether conditions pass/fail (use the task output in later tasks)"/>
23-
<property name="gatePassed" category="output" description="Whether all conditions"/>
22+
<property name="useOutput" category="input" kind="boolean" description="Complete task regardless of condition results (output can be used in subsequent tasks)"/>
23+
<property name="gatePassed" category="output" description="Indicates whether the gate conditions were satisfied"/>
2424
</type>
2525
</synthetic>

0 commit comments

Comments
 (0)