Services¶
flowtask.services
¶
bots
¶
files
¶
Files.
File Management Infraestructure
FileManager
¶
Bases: BaseView
API View for managing Files.
delete
async
¶
DELETe Method. description: Deletes a File (if exists) on Directory tags: - files - File Manager - filesystem - file consumes: - application/json produces: - application/json
get
async
¶
GET Method.¶
description: Managing Files. tags: - File Manager consumes: - application/json produces: - application/json
head
async
¶
HEAD Method. description: Sent response about file exists or not. tags: - files - File Manager - filesystem - file consumes: - application/json produces: - application/json
post
async
¶
POST Method. description: upload a file onto repository directory. tags: - files - File Manager - filesystem - file consumes: - application/json produces: - application/json
put
async
¶
PUT Method. description: Create a new directory. tags: - files - File Manager - filesystem - file consumes: - application/json produces: - application/json
FileService
¶
Bases: BaseView
get
async
¶
description: Get all the Files objects in the current scope and program summary: get the files information and attributes tags: - FileService produces: - application/json parameters: - name: user_id description: user id to filter in: path required: true type: integer - name: file_slug description: file slug in: path required: true type: string responses: "200": description: returns valid data "204": description: No data "403": description: Forbidden Call "404": description: Program o File not found "406": description: Query Error
put
async
¶
PUT FileService. description: Upload a File and, optionally, running an associated Task Parameters: file_slug: slug of the file in TROC files table program_slug: associated program mimetype: optional mime-type, default csv module_id: optional module ID task: boolean in query-params to disable running task. long_running: query-param to attach a Task in a Thread Pool
valid_permission
async
¶
valid_permission. Check if the user have permission for one func on the system.
manager
¶
FileManager.
Works with files, download, upload and delete files over FS using an API.
TODO: Send a data-preview (first 10 rows) of uploaded file TODO: html-template for Uploader preview with "back" button.
FileManager
¶
Bases: BaseView
API View for managing Files.
delete
async
¶
DELETe Method. description: Deletes a File (if exists) on Directory tags: - files - File Manager - filesystem - file consumes: - application/json produces: - application/json
get
async
¶
GET Method.¶
description: Managing Files. tags: - File Manager consumes: - application/json produces: - application/json
head
async
¶
HEAD Method. description: Sent response about file exists or not. tags: - files - File Manager - filesystem - file consumes: - application/json produces: - application/json
post
async
¶
POST Method. description: upload a file onto repository directory. tags: - files - File Manager - filesystem - file consumes: - application/json produces: - application/json
put
async
¶
PUT Method. description: Create a new directory. tags: - files - File Manager - filesystem - file consumes: - application/json produces: - application/json
model
¶
FileService DB Model.
Database Object Model for FileServices.
service
¶
FileService.
Work with slug-based file definitions, upload, download, enable tasks, etc.
FileService
¶
Bases: BaseView
get
async
¶
description: Get all the Files objects in the current scope and program summary: get the files information and attributes tags: - FileService produces: - application/json parameters: - name: user_id description: user id to filter in: path required: true type: integer - name: file_slug description: file slug in: path required: true type: string responses: "200": description: returns valid data "204": description: No data "403": description: Forbidden Call "404": description: Program o File not found "406": description: Query Error
put
async
¶
PUT FileService. description: Upload a File and, optionally, running an associated Task Parameters: file_slug: slug of the file in TROC files table program_slug: associated program mimetype: optional mime-type, default csv module_id: optional module ID task: boolean in query-params to disable running task. long_running: query-param to attach a Task in a Thread Pool
valid_permission
async
¶
valid_permission. Check if the user have permission for one func on the system.
jira
¶
JiraActions
¶
:param server: Server URL. :param email: User Email. :param token: API token of Jira.
add_comment
¶
Adds a comment to a Jira issue.
:param issue_key: Key of the issue to add the comment to. :param comment: The comment to be added. :return: Returns the added comment or raises an exception in case of error.
add_worklog
¶
Adds a worklog entry to a Jira issue.
:param issue_key: Key of the issue to which the worklog will be added. :param time_spent: Time spent on the issue (e.g., '2h', '3d', '1w'). :param comment: Optional comment to add with the worklog. :param started: Date and time the work started (optional, format: 'YYYY-MM-DDTHH:MM:SS.000+0000'). :return: The worklog entry that was added, or raises an exception in case of error.
assign_issue
¶
Assigns a Jira issue to a specified user.
:param issue_key: Key of the issue to be assigned (e.g., 'PROJ-123'). :param assignee: Username or email of the user to whom the issue will be assigned. :return: The updated issue after the assignment.
create_issue
¶
Creates a new Jira issue in the specified project.
:param project_key: Key of the project in which the ticket is to be created. :param summary: Summary or title of the ticket. :param description: Description of the ticket. :param issue_type: Type of ticket (default 'Task'). :return: Returns the ticket created.
handle_jira_error
staticmethod
¶
Handles errors and exceptions that occur during interactions with Jira.
This function captures exceptions thrown during Jira operations and raises appropriate errors with relevant messages based on the type of exception (e.g., JIRAError, connection issues).
:param e: Exception object. This can be a JIRAError or other types of exceptions (e.g., connection errors). :param action: A string describing the action that was being attempted when the error occurred (e.g., 'creating an issue', 'adding a comment').
:raises ValueError: If there is a validation error (e.g., incorrect data in Jira fields). :raises PermissionError: If the user does not have sufficient permissions for the Jira operation. :raises ConnectionError: If there is a problem connecting to the Jira server or if the requested resource was not found. :raises TimeoutError: If the operation timed out while connecting to the Jira server. :raises Exception: For any other unexpected errors that occur during the Jira operation.
list_issues
¶
Return a list of Jira issues.
:return: The list of closed issues assigned to user.
list_transitions
¶
Return a list of a valid transitions of a issue.
:param issue_key: Key of the issue to transition. :return: Returns the list of a valid transitions of a issue.
transition_issue
¶
Transitions a Jira issue to a new status based on the transition name. If the transition name is invalid, provides a list of valid transitions for the issue.
:param issue_key: Key of the issue to transition. :param transition_name: Name of the transition to perform (e.g., 'Start Progress', 'Close Issue'). :param comment: Optional comment to add during the transition. :return: Returns the issue after the transition or raises an exception in case of error.
jira_actions
¶
JiraActions
¶
:param server: Server URL. :param email: User Email. :param token: API token of Jira.
add_comment
¶
Adds a comment to a Jira issue.
:param issue_key: Key of the issue to add the comment to. :param comment: The comment to be added. :return: Returns the added comment or raises an exception in case of error.
add_worklog
¶
Adds a worklog entry to a Jira issue.
:param issue_key: Key of the issue to which the worklog will be added. :param time_spent: Time spent on the issue (e.g., '2h', '3d', '1w'). :param comment: Optional comment to add with the worklog. :param started: Date and time the work started (optional, format: 'YYYY-MM-DDTHH:MM:SS.000+0000'). :return: The worklog entry that was added, or raises an exception in case of error.
assign_issue
¶
Assigns a Jira issue to a specified user.
:param issue_key: Key of the issue to be assigned (e.g., 'PROJ-123'). :param assignee: Username or email of the user to whom the issue will be assigned. :return: The updated issue after the assignment.
create_issue
¶
Creates a new Jira issue in the specified project.
:param project_key: Key of the project in which the ticket is to be created. :param summary: Summary or title of the ticket. :param description: Description of the ticket. :param issue_type: Type of ticket (default 'Task'). :return: Returns the ticket created.
handle_jira_error
staticmethod
¶
Handles errors and exceptions that occur during interactions with Jira.
This function captures exceptions thrown during Jira operations and raises appropriate errors with relevant messages based on the type of exception (e.g., JIRAError, connection issues).
:param e: Exception object. This can be a JIRAError or other types of exceptions (e.g., connection errors). :param action: A string describing the action that was being attempted when the error occurred (e.g., 'creating an issue', 'adding a comment').
:raises ValueError: If there is a validation error (e.g., incorrect data in Jira fields). :raises PermissionError: If the user does not have sufficient permissions for the Jira operation. :raises ConnectionError: If there is a problem connecting to the Jira server or if the requested resource was not found. :raises TimeoutError: If the operation timed out while connecting to the Jira server. :raises Exception: For any other unexpected errors that occur during the Jira operation.
list_issues
¶
Return a list of Jira issues.
:return: The list of closed issues assigned to user.
list_transitions
¶
Return a list of a valid transitions of a issue.
:param issue_key: Key of the issue to transition. :return: Returns the list of a valid transitions of a issue.
transition_issue
¶
Transitions a Jira issue to a new status based on the transition name. If the transition name is invalid, provides a list of valid transitions for the issue.
:param issue_key: Key of the issue to transition. :param transition_name: Name of the transition to perform (e.g., 'Start Progress', 'Close Issue'). :param comment: Optional comment to add during the transition. :return: Returns the issue after the transition or raises an exception in case of error.
tasks
¶
Tasks.
Task-based management, creation and execution of tasks.
TaskLauncher
¶
Bases: BaseView
post
async
¶
POST Method. description: Executing a Task tags: - tasks - DataIntegration consumes: - application/json produces: - application/json responses: "200": description: Existing Task was updated or executed. "201": description: New Task was inserted "202": description: Task was accepted to run "400": description: Task Failed to execute "403": description: Forbidden Call "404": description: No Data was found "406": description: Query Error "409": description: Conflict, a constraint was violated
TaskManager
¶
Bases: BaseView
TaskManager.
description: API Endpoint for Task Management (creation of Tasks).
delete
async
¶
DELETE Method. description: remove resource. tags: - tasks - DataIntegration produces: - application/json responses: "200": description: Existing Task was updated. "201": description: New Task was inserted "403": description: Forbidden Call "404": description: No Data was found "406": description: Query Error "409": description: Conflict, a constraint was violated
get
async
¶
GET Method.¶
description: get all tasks, or a task by ID (or get status of execution) tags: - tasks - DataIntegration consumes: - application/json produces: - application/json responses: "200": description: Existing Task was retrieved. "403": description: Forbidden Call "404": description: No Task(s) were found "406": description: Query Error
patch
async
¶
PATCH Method. description: updating partially info about a Task tags: - tasks - DataIntegration produces: - application/json responses: "200": description: Existing Task was updated. "201": description: New Task was inserted "304": description: Task not modified, its currently the actual version of Task "403": description: Forbidden Call "404": description: No Data was found "406": description: Query Error "409": description: Conflict, a constraint was violated
post
async
¶
PATCH Method. description: updating or creating tasks tags: - tasks - DataIntegration produces: - application/json responses: "200": description: Existing Task was updated. "201": description: New Task was inserted "304": description: Task not modified, its currently the actual version of Task "403": description: Forbidden Call "404": description: No Data was found "406": description: Query Error "409": description: Conflict, a constraint was violated
put
async
¶
PUT Method. description: Send a Task as Code directly to Task Executor. tags: - tasks - DataIntegration produces: - application/json consumes: - application/merge-patch+json - application/json responses: "200": description: Task Executed "204": description: success execution but no content on return (resource was deleted) "400": description: Invalid resource according data schema "403": description: Forbidden Call "404": description: No Data was found "406": description: Query Error "409": description: Conflict, a constraint was violated
TaskService
¶
Bases: BaseView
TaskService.
Task As a Service: launch data-based tasks and returning the resultset in useful formats. Args: BaseView (type): description
get
async
¶
GET Method. description: Executing a Task and returning the result tags: - tasks - DataIntegration consumes: - application/json produces: - application/json responses: "200": description: Existing Task was executed. "202": description: Task was accepted to queue (no return) "204": description: No data was found "400": description: Task Failed to execute "403": description: Forbidden Call "404": description: no Task was found. "406": description: Query Error "409": description: Task Conflict, a constraint was violated
post
async
¶
GET Method. description: Executing a Task and returning the result tags: - tasks - DataIntegration consumes: - application/json produces: - application/json responses: "200": description: Existing Task was executed. "202": description: Task was accepted to queue (no return) "204": description: No data was found "400": description: Task Failed to execute "403": description: Forbidden Call "404": description: no Task was found. "406": description: Query Error "409": description: Task Conflict, a constraint was violated
launch_task
async
¶
launch_task(program_slug, task_id, loop=None, task_uuid=None, queued=False, no_worker=False, priority='low', userid=None, **kwargs)
launch_task. Runs (or queued) a Task from Task Monitor.
launcher
¶
TaskService.
Work with managing tasks, creation, deleting, listing, etc.
TaskLauncher
¶
Bases: BaseView
post
async
¶
POST Method. description: Executing a Task tags: - tasks - DataIntegration consumes: - application/json produces: - application/json responses: "200": description: Existing Task was updated or executed. "201": description: New Task was inserted "202": description: Task was accepted to run "400": description: Task Failed to execute "403": description: Forbidden Call "404": description: No Data was found "406": description: Query Error "409": description: Conflict, a constraint was violated
manager
¶
TaskManager.
Task Management: creation, deleting, listing, etc.
TaskManager
¶
Bases: BaseView
TaskManager.
description: API Endpoint for Task Management (creation of Tasks).
delete
async
¶
DELETE Method. description: remove resource. tags: - tasks - DataIntegration produces: - application/json responses: "200": description: Existing Task was updated. "201": description: New Task was inserted "403": description: Forbidden Call "404": description: No Data was found "406": description: Query Error "409": description: Conflict, a constraint was violated
get
async
¶
GET Method.¶
description: get all tasks, or a task by ID (or get status of execution) tags: - tasks - DataIntegration consumes: - application/json produces: - application/json responses: "200": description: Existing Task was retrieved. "403": description: Forbidden Call "404": description: No Task(s) were found "406": description: Query Error
patch
async
¶
PATCH Method. description: updating partially info about a Task tags: - tasks - DataIntegration produces: - application/json responses: "200": description: Existing Task was updated. "201": description: New Task was inserted "304": description: Task not modified, its currently the actual version of Task "403": description: Forbidden Call "404": description: No Data was found "406": description: Query Error "409": description: Conflict, a constraint was violated
post
async
¶
PATCH Method. description: updating or creating tasks tags: - tasks - DataIntegration produces: - application/json responses: "200": description: Existing Task was updated. "201": description: New Task was inserted "304": description: Task not modified, its currently the actual version of Task "403": description: Forbidden Call "404": description: No Data was found "406": description: Query Error "409": description: Conflict, a constraint was violated
put
async
¶
PUT Method. description: Send a Task as Code directly to Task Executor. tags: - tasks - DataIntegration produces: - application/json consumes: - application/merge-patch+json - application/json responses: "200": description: Task Executed "204": description: success execution but no content on return (resource was deleted) "400": description: Invalid resource according data schema "403": description: Forbidden Call "404": description: No Data was found "406": description: Query Error "409": description: Conflict, a constraint was violated
service
¶
TaskService.
Service for running tasks.
TaskService
¶
Bases: BaseView
TaskService.
Task As a Service: launch data-based tasks and returning the resultset in useful formats. Args: BaseView (type): description
get
async
¶
GET Method. description: Executing a Task and returning the result tags: - tasks - DataIntegration consumes: - application/json produces: - application/json responses: "200": description: Existing Task was executed. "202": description: Task was accepted to queue (no return) "204": description: No data was found "400": description: Task Failed to execute "403": description: Forbidden Call "404": description: no Task was found. "406": description: Query Error "409": description: Task Conflict, a constraint was violated
post
async
¶
GET Method. description: Executing a Task and returning the result tags: - tasks - DataIntegration consumes: - application/json produces: - application/json responses: "200": description: Existing Task was executed. "202": description: Task was accepted to queue (no return) "204": description: No data was found "400": description: Task Failed to execute "403": description: Forbidden Call "404": description: no Task was found. "406": description: Query Error "409": description: Task Conflict, a constraint was violated
task_manager
¶
TaskManager.
Work with managing tasks, creation, deleting, listing, etc.
TaskManager
¶
Bases: DataView
delete
async
¶
DELETE Method. description: remove resource. tags: - tasks - DataIntegration produces: - application/json responses: "200": description: Existing Task was updated. "201": description: New Task was inserted "403": description: Forbidden Call "404": description: No Data was found "406": description: Query Error "409": description: Conflict, a constraint was violated
get
async
¶
GET Method.¶
description: get all tasks, or a task by ID (or get status of execution) tags: - tasks - DataIntegration consumes: - application/json produces: - application/json responses: "200": description: Existing Task was retrieved. "403": description: Forbidden Call "404": description: No Task(s) were found "406": description: Query Error
patch
async
¶
PATCH Method. description: updating partially info about a Task tags: - tasks - DataIntegration produces: - application/json responses: "200": description: Existing Task was updated. "201": description: New Task was inserted "304": description: Task not modified, its currently the actual version of Task "403": description: Forbidden Call "404": description: No Data was found "406": description: Query Error "409": description: Conflict, a constraint was violated
post
async
¶
POST Method. description: inserting or updating a Task or executing a Task tags: - tasks - DataIntegration consumes: - application/json produces: - application/json responses: "200": description: Existing Task was updated or executed. "201": description: New Task was inserted "202": description: Task was accepted to run "400": description: Task Failed to execute "403": description: Forbidden Call "404": description: No Data was found "406": description: Query Error "409": description: Conflict, a constraint was violated
put
async
¶
PUT Method. description: inserting or updating a Task tags: - tasks - DataIntegration produces: - application/json consumes: - application/merge-patch+json - application/json responses: "200": description: Existing Task was updated. "201": description: New Task was inserted "204": description: success execution but no content on return (resource was deleted) "400": description: Invalid resource according data schema "403": description: Forbidden Call "404": description: No Data was found "406": description: Query Error "409": description: Conflict, a constraint was violated