-
Notifications
You must be signed in to change notification settings - Fork 10
Add TaskStage API support with models, resource, tests and examples #148
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
5fd26cb
Add TaskStage API support with models, resource, tests and examples
TanyaSingh369-svg 35ef47c
fixed lint issue
TanyaSingh369-svg 8b2ecfb
Merge branch 'next-1.0.0' into feature/task-stage-api
TanyaSingh369-svg 09d33c7
fix: clean task stage model and update example to follow SDK patterns
TanyaSingh369-svg 68a29e1
fix: map task stage relationships in parser
TanyaSingh369-svg 63e6574
fix: resolve lint issues in task stage api
TanyaSingh369-svg da684e0
fix: resolve task stage relationship parsing
TanyaSingh369-svg 640e476
fix: improve task stage relationship modeling
TanyaSingh369-svg 24e69f9
refactor: simplify task stage relationship handling
TanyaSingh369-svg 2c90b0f
Export TaskStage and TaskResult models
TanyaSingh369-svg 0e615b2
Merge branch 'next-1.0.0' into feature/task-stage-api
TanyaSingh369-svg 004e5c3
Fix TaskStage reviewer feedback and validation handling
TanyaSingh369-svg e6e6574
Update task stage validation error handling
TanyaSingh369-svg bb421c9
Fix TaskStage forward reference rebuild handling
TanyaSingh369-svg 1c6a535
Merge branch 'next-1.0.0' into feature/task-stage-api
TanyaSingh369-svg 817bb8e
Trigger CI
TanyaSingh369-svg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| """ | ||
| Example usage of TaskStages API | ||
|
|
||
| Demonstrates: | ||
| - Read a task stage | ||
| - List task stages for a run | ||
| - Override a task stage | ||
| """ | ||
|
|
||
| import os | ||
| import sys | ||
|
|
||
| sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "src")) | ||
|
|
||
| from pytfe import TFEClient, TFEConfig | ||
|
|
||
|
|
||
| def main(): | ||
| client = TFEClient(TFEConfig.from_env()) | ||
|
|
||
| task_stage_id = os.getenv("TFE_TASK_STAGE_ID") | ||
| run_id = os.getenv("TFE_RUN_ID") | ||
|
|
||
| if not task_stage_id or not run_id: | ||
| print("Please set TFE_TASK_STAGE_ID and TFE_RUN_ID") | ||
| return | ||
|
|
||
| print("=== TaskStages Example ===") | ||
|
|
||
| # READ | ||
| print("\nReading task stage...") | ||
| try: | ||
| stage = client.task_stages.read(task_stage_id) | ||
| print(f"ID: {stage.id}") | ||
| print(f"Stage: {stage.stage}") | ||
| print(f"Status: {stage.status}") | ||
| print(f"Run: {stage.run.id if stage.run else None}") | ||
| except Exception as e: | ||
| print(f"Read failed: {e}") | ||
|
|
||
| # LIST | ||
| print("\nListing task stages...") | ||
| try: | ||
| stages = list(client.task_stages.list(run_id)) | ||
| for s in stages: | ||
| print(f"{s.id} - {s.status}") | ||
| except Exception as e: | ||
| print(f"List failed: {e}") | ||
|
|
||
| # OVERRIDE | ||
| print("\nOverriding task stage...") | ||
| try: | ||
| client.task_stages.override(task_stage_id, comment="Approved") | ||
| print("Override successful") | ||
| except Exception as e: | ||
| print(f"Override failed: {e}") | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| main() | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.