Task's state explained

Automation Workshop does Tasks! In essence, a Task is the primary operational unit of Automation Workshop. A Task contains full set of instructions which determines what, when, and how of the Task execution. That is why a good understanding of Task structure and states is crucial for efficient system automation. The purpose of this article is to comprehensively explain you the workings of a Task in step-by-step manner.

Task states…

First of all, every Task in Automation Workshop can be in one of the opposite states, namely, any given Task is either Enabled or Disabled.

What is the difference between enabled and disabled Task? Simply put, disabled Tasks can not execute themselves. Obviously, we would like enabled Tasks to perform their operations, while expecting disabled Tasks to just do nothing. This applies to the situations when the following happens:

  • Automation Workshop service is started automatically at system startup.
  • Automation Workshop service is started manually from Service tab of Automation Workshop options.
  • A Task disables itself upon successful or failed execution.
  • User changes the Task state, namely, enables or disables it.
  • Task state is changed by Enable Task, Disable Task or Toggle Task Action.
  • A new Task is just created.

In other words, every time when a Task is designed, loaded, or its state is changed, we had better make sure whether we would like enabled or disabled at a particular moment. Remember, the state of a Task can be changed in various simple ways, such as:

  • Selecting Task in Automation Workshop interface and choosing Enable or Disable Task in File - Properties menu. Alternatively, click right mouse button on a Task and select Enable / Disable option from context menu.
  • By checking / unchecking the This Task is enabled box in Task tab of Task properties. Task properties can be opened by double clicking the Task or selecting it and pushing Enter as well as from the File menu.
  • By telling the appropriate Action within either the same Task or a different one to enable or disable it. Enable Task Action enables the specified Task. Disable Task Action disables the specified Task. Toggle Task Action changes Task state to the opposite, namely, enables the disabled Tasks and disables the enabled ones.
  • The Task can automatically disable itself upon successful task execution, failed task execution, or both if told to do so in On Success or On Error tab of Task properties, respectively.
Run As settings…

Upon Automation Workshop service startup, it reads all Tasks into computer memory. Enabled Tasks are activated according to Run As settings which specify whether and from which user account (with what credentials) the Task will be executed both if user is logged in or if user is logged off at the moment of Task execution. For example, you can choose among Task execution scenarios like these and others:

  • Run Task with credentials of currently logged user and do not run Task when no user is logged on.
  • Run Task in Service account (SYSTEM) both when user is logged in and when no user is logged on.
  • Run Task with credentials of particular user only if no user is currently logged on.
  • Run Task with credentials of particular user only if some user is currently logged in and with credentials of some other user if no user is logged on.

Disabled Tasks, on the contrary, are only loaded into memory, but not activated. Which, roughly speaking, means that they can not automatically execute themselves.

What is the difference between the Tasks that are activated and those which are not? The only difference between active and inactive Tasks lies in status of their Triggers. A Trigger is the part of a Task which specifies when / on what conditions the Task should execute. Trigger monitors the system and continuously compares its state with predefined set of criteria. When they match, Trigger automatically executes the Task.

Trigger states…

Thus, the Task can be considered active if at least one of its Triggers is enabled. Relatedly, when the Task is disabled, all its Triggers become automatically disabled, too. Conversely, if the Triggers are disabled, Task is inactive. If a Task contains no Triggers, there is no difference between enabled and disabled Task status.

Generally speaking, the Triggers of enabled Tasks monitor the system ready to execute the Task. The Triggers of disabled Tasks do not monitor anything and will not execute the Task. It does not mean though that disabled Tasks can not be executed. Even if a Task contains no Triggers or is disabled, it can still be executed both manually and by using Start Task Action which can execute both enabled and disabled Tasks as specified.

Task triggering…

The execution of a Task can happen both automatically and manually. While manual Task execution presupposes user to run a Task from Automation Workshop manager, automatic Task execution is possible in three distinct ways:

Suppose the Task is executed. It is important to understand that a Task does not only consists of Triggers, but also of Actions. Actions are sets of commands that are performed when the Task is executed. In fact, the very Actions are responsible for everything done by Automation Workshop (except logging and email reporting), while Triggers only specify when to do that.

When the Task is already executed, the role of the Trigger is over. However, it is worth to note that Triggers can be functionally connected with Actions by using Variable Wizard.

For example, File / Folder Watcher monitors specified folder for incoming Word document .doc files and, when a new file arrives, remembers its name and executes a Task which starts to sequentially perform the specified Actions. Send email Action then (by using Variable Wizard) can ask File / Folder Watcher Trigger a name of recently monitored file and add the file as attachment when sending email.
See example - Monitor folder and automatically send email with report files.

On other occasions there is no need to link Triggers with Actions. For example, running predefined file copying operations at specified time (by using Task Scheduler Trigger) where the date and time of execution is not in any way related to the file copying operations performed by Copy file Action.

Other than that, when the Task is executed (triggered by Trigger, started by Action or launched manually) it does not matter anymore whether it is enabled or disabled. From this point forward, the Task just runs. In other words, Task State is only relevant relatedly to Task execution conditions. The state of already running Task is irrelevant for all that matters.

Task start-up…

When executed, a Task verifies Run As settings, i.e., checks whether and which user is logged on, what credentials apply to current situation. After verification of user account credentials, the Task also checks whether another instance of the same Task is not already running and, if it does, acts as specified in Settings tab of Task properties. Namely, if an instance of already running Task is being executed, Automation Workshop can be instructed to:

  • Run task in parallel.
  • Do not start the new task.
  • Stop existing task and start the new instance.
  • Stop existing task and do not start the new instance.
  • Queue a new task instance until existing task finishes.

Likewise, upon execution, the Task also checks whether the Simultaneous Task Limit, specified in Queue manager options is not exceeded.

When all above mentioned conditions are met, the Task finally really starts to do its operations by sequentially performing the specified Actions. Note that each Action can be individually enabled or disabled. Enabled Actions perform their operations and disabled ones just do nothing due to being skipped.

Task execution…

Depending on chosen log level of the Task, each Action writes more or less information on its operations into the log file which can be easily reviewed later. There are four log levels available:

  • Log everything - writes all possible information into the log file.
  • Default logging - writes the most relevant information into the log file.
  • Log only Task errors and warning - logs data only in case of possible or actual errors.
  • Disable log for this Task - does not log anything at all.

Besides logging data in main log file, each Task can be configured to maintain an individual log file, thus providing user with options to individually track the operations of most important or critical Tasks.

When all Task Actions are completed, the Task itself finishes. If no Action has experienced an error during, the Task execution is considered successful. Otherwise, the Task completion status is set to failed. As advanced solution which requires minimum user interference, Febooti Automation Workshop explicitly distinguishes successful completion from failed completion. The further operations in case of any of the possible outcomes are specified separately. Both in case of successful completion and failure of the Task, Automation Workshop can send email report, run some other Task, write to Windows System Event log or disable the Task.

Error handling…

When the Task is completed, its statistics are updated. Task statistics contains information on number of times the Task has been executed, its longest, shortest and average execution times as well as some other information. After each completion of the Task, average run time is re-calculated. If the Task has performed much faster or slower than usual, the respective run time is updated.

Task statistics…

Task statistics provides good means to overview Task execution and can help to track down some actual or possible problems (e.g. seeing that successful completion / failure ratio is higher than expected or some run times happen to be unusually slow or fast). While requiring some acquaintance with the program, statistics can still provide user with useful hints on Task operations.

CONCLUSION.
A Task can be in one of two possible states, namely, either enabled or disabled.

Enabled task:

  • Is loaded with user credentials specified in Run As tab of Task properties.
  • Task Triggers are enabled and actively monitor the system to execute the Task when criteria are met.
  • When executed, the Task verifies Run As settings and user credentials once more.
  • Task Actions are sequentially performed.
  • User specified log level of data on Action operations is logged into log file.
  • When Actions are completed, Task statistics is saved.
  • Depending on whether there have been errors during Task execution, Automation Workshop performs operations specified either in On Error or On Success tab of Task properties.

Disabled task:

  • The Triggers are not enabled and thus do not execute the Task.
  • Disabled Task can be run either manually by user or automatically by Start Task Action or other Task.
  • When a Task is already executed, there is no more difference between enabled and disabled Task.
Additional Febooti Automation Workshop resources:
  • Getting started - Automation Workshop basic concepts explained.
  • Streamline processes by connecting Triggers and Actions using Variable Wizard.
  • Febooti Automation Workshop Triggers and Actions.
  • Workshop manager - main user interface gives user an easy access to all Automation Workshop features.
  • Queue manager - provides overview of all currently running and pending Tasks.
  • Log manager - provides comprehensive information on Task execution process successful finishes and failures.

If you have any questions, please do not hesitate to contact our support team.

© 2001–2018 Febooti Ltd.