Routine and background tasks. Difference between tasks and functions

Job mechanism

The job engine is designed to perform any application or functionality on a schedule or asynchronously.

The task mechanism solves the following problems:

  • Ability to define regulatory procedures at the system configuration stage;
  • Execution of specified actions according to schedule;
  • Making a call to a given procedure or function asynchronously, i.e. without waiting for its completion;
  • Tracking the progress of a specific task and obtaining its completion status (a value indicating whether it was successful or not);
  • Obtaining a list of current tasks;
  • Ability to wait for one or more tasks to complete;
  • Job management (possibility of cancellation, blocking of execution, etc.).

The job mechanism consists of the following components:

  • Metadata of routine tasks;
  • Regular tasks;
  • Background jobs;
  • Task Scheduler.

Background jobs - intended to be executed applied problems asynchronously. Background tasks are implemented using the built-in language.

Scheduled tasks - designed to perform applied tasks on a schedule. Routine tasks are stored in the information base and are created based on metadata defined in the configuration. Metadata of a regulatory task contains information such as name, method, use, etc.

A routine task has a schedule that determines at what times the method associated with the routine task must be executed. The schedule, as a rule, is specified in the information base, but can also be specified at the configuration stage (for example, for predefined routine tasks).

The task scheduler is used to schedule the execution of routine tasks. For each scheduled task, the scheduler periodically checks whether the The current date and time to the routine task schedule. If it matches, the scheduler assigns that task to execution. To do this, for this scheduled task, the scheduler creates a background task, which performs the actual processing.

Background jobs

Background jobs are convenient to use to perform complex calculations when the calculation result can be obtained via long time. The job engine has the means to perform such calculations asynchronously.

Associated with a background job is a method that is called when the background job runs. Any procedure or function that is not global can act as a background job method. common module, which can be called on the server. Background job parameters can be any values ​​that are allowed to be passed to the server. The parameters of a background job must exactly match the parameters of the procedure or function that it calls. If the background job's method is a function, its return value is ignored.

A background job can have a key - any application value. The key introduces a restriction on the launch of background jobs - only one background job can be executed per unit of time with a certain value key and given name background job method (the method name consists of the module name and the name of the procedure or function). Key allows grouping background jobs, having the same methods, according to a certain application characteristic, so that no more than one background job is executed within the same group.

Background jobs are created and managed programmatically from any connection. Any user is allowed to create a background job. Moreover, it is executed on behalf of the user who created it. Receiving tasks, as well as waiting for their completion, is allowed from any connection to a user with administrative rights, or the user who created these background jobs.

A background job is a pure session object, but does not belong to any user session. For each task, a special system session is created, running on behalf of the user who made the call. Background jobs do not have persistent state.

A background job can spawn other background jobs. In the client-server version, this allows parallelization complex calculations across cluster worker processes, which can significantly speed up the overall computation process. Parallelization is implemented by spawning several child background jobs and waiting for each of them to complete in the main background job.

Background jobs that complete successfully or fail are stored for 24 hours and then deleted. If the number of completed background jobs exceeds 1000, the oldest background jobs are also deleted.

Scheduled tasks

Scheduled tasks are used when it is necessary to perform certain periodic or one-time actions according to a schedule.

Scheduled tasks are stored in the information base and are created based on the metadata of the routine task defined in the configuration. Metadata specifies such parameters of a routine task as: called method, name, key, possibility of use, sign of predetermination, etc. When creating a routine task, you can additionally specify the schedule (can be specified in the metadata), values ​​of the method parameters, name of the user on whose behalf the be carried out routine task, and etc.

The creation and management of scheduled tasks is performed programmatically from any connection and is allowed only to users with administrative rights.

Note. When working in the file version, it is possible to create and edit routine tasks without launching the task scheduler.

Associated with a routine task is a method that is called when the routine task is executed. The routine task method can be any procedure or function of a non-global common module that can be called on the server. The parameters of a routine task can be any values ​​that are allowed to be transmitted to the server. The parameters of a routine task must exactly match the parameters of the procedure or function that it calls. If the routine task method is a function, then its return value is ignored.

A routine task can have a key - any application value. The key introduces a restriction on the launch of scheduled tasks, because per unit of time, among routine tasks associated with the same metadata object, only one routine task with a specific key value can be executed. The key allows you to group routine tasks associated with the same metadata object according to a specific application characteristic so that no more than one routine task is performed within one group.

During configuration, you can define predefined routine tasks. Predefined routine tasks are no different from regular routine tasks, except that they cannot be explicitly created or deleted. If in the metadata of the scheduled task it is set sign of a predetermined routine task, then when updating the configuration in the infobase, a predefined routine task will be automatically created. If the predetermined flag is cleared, then when updating the configuration in the infobase, the predefined routine task will be automatically deleted. Initial values properties of a predefined routine task (for example, a schedule) are set in the metadata. In the future, when the application is running, they can be changed. Predefined routine tasks have no parameters.

The routine task schedule determines at what times the routine task should be run. The schedule allows you to set: the date and time of the start and end of the task, the execution period, the days of the week and months by which the scheduled task must be performed, etc. (see the description of the built-in language).

Examples of routine task schedules:

Every hour, just one day

RepeatDays Period = 0, RepeatDays Period = 3600

Every day once a day

RepeatDays Period = 1, RepeatDays Period = 0

One day, one time

PeriodRepeatDays = 0

Every other day once a day

PeriodRepeatDays = 2

Every hour from 01.00 to 07.00 every day

PeriodRepeatDays = 1

Repeat PeriodDuring Day = 3600

Start Time = 01.00

End Time = 07.00

Every Saturday and Sunday at 09.00

PeriodRepeatDays = 1

Days of the Week = 6, 7

Start Time = 09.00

Every day for one week, skip a week

PeriodRepeatDays = 1

PeriodWeeks = 2

At 01.00 once

Start Time = 01.00

Last day of every month at 9:00.

PeriodRepeatDays = 1

DayInMonth = -1

Start Time = 09.00

Fifth day of every month at 9:00

PeriodRepeatDays = 1

DayInMonth = 5

Start Time = 09.00

Second Wednesday of every month at 9:00

PeriodRepeatDays = 1

DayWeekInMonth = 2

Days of the Week = 3

Start Time = 09.00

You can check whether a task is running for a given date (the RequiredExecution method of the ScheduleTasks object). Scheduled tasks are always performed under the name of a specific user. If the user of the scheduled task is not specified, then execution occurs on behalf of the default user who has administrative rights.

Routine tasks are executed using background tasks. When the scheduler determines that a scheduled task should be launched, a background job is automatically created based on this scheduled task, which performs all further processing. If this routine task is already running, it will not be run again, regardless of its schedule.

Scheduled tasks can be restarted. This is especially true when the routine task method must be guaranteed to be executed. A routine task is restarted when it terminates abnormally, or when the worker process (in the client-server version) or the client process (in the file version) on which the routine task was executed is terminated abnormally. In the scheduled task, you can specify how many times it needs to be restarted, as well as the interval between restarts. When implementing the restartable routine task method, you must take into account that when restarted, its execution will start from the beginning, and not continue from the moment of abnormal termination.

It's important to remember that End time will not necessarily complete the background job at the specified time. Some statements:

* A background job can ignore its automatic cancellation if it is not frozen but continues to run because not all platform operations can be canceled. If the cyclic code of the built-in language is executed, then the job can be canceled, otherwise not. It all depends on what the job does. * End time - the boundary within which a task can start rather than end? * Force termination does the job roll back the changes made to the start of the transaction?

Features of executing background jobs in file and client-server variants

The mechanisms for executing background jobs in the file and client-server versions are different.

  • In the file version, you need to create a dedicated client process that will perform background jobs. To do this, the client process must periodically call the global context function ExecuteJobProcessing. Only one client process per infobase should process background jobs (and, accordingly, call this function). If a client process has not been created to process background jobs, then when programmatically accessing the job engine, the error “Job Manager is not active” will be displayed. It is not recommended to use a client process that processes background jobs for other functions.

Once the client process processing background jobs has started, other client processes can software access to the mechanism of background jobs, i.e. can run and manage background jobs.

In the client-server version, a task scheduler is used to execute background jobs, which is physically located in the cluster manager. For all queued background jobs, the scheduler gets the least loaded worker process and uses it to run the corresponding background job. The worker process executes the job and notifies the scheduler of the execution results.

In the client-server version, it is possible to block the execution of routine tasks. The execution of routine tasks is blocked in the following cases:

  • An explicit blocking of routine tasks has been installed on the information base. The lock can be set via the cluster console;
  • There is a connection block on the infobase. The lock can be set via the cluster console;
  • The SetExclusiveMode() method with the True parameter was called from the built-in language;
  • In some other cases (for example, when updating the database configuration).

Creating metadata for a routine task

Before you programmatically create a routine task in the infobase, you need to create a metadata object for it.

To create a metadata object for a routine task in the configuration tree in the “General” branch for the “Routine tasks” branch, execute the “Add” command and fill in the following properties of the routine task in the properties palette:

Method name - indicate the name of the routine task method.

Key - arbitrary specified string value, which will be used as the key of the scheduled task.

Schedule - indicates the schedule of the routine task. To create a schedule, click the “Open” link and in the schedule form that opens, set the required values.

On the “General” tab, the start and end dates of the task and the repeat mode are indicated.

On the “Daily” tab, the daily schedule of the task is indicated.

Please indicate your schedule:

  • start time and end time of the task;
  • the task completion time, after which it will be forced to terminate;
  • task repetition period;
  • duration of pause between repetitions;
  • execution duration.

It is allowed to specify an arbitrary combination of conditions.

On the “Weekly” tab, the weekly schedule of the task is indicated.

Select the checkboxes for the days of the week on which the task will be executed. If you want to repeat the task, specify the repeat interval in weeks. For example, the task is executed in 2 weeks, the repeat value is 2.

On the “Monthly” tab, the monthly schedule of the task is indicated.

Select the checkboxes for the months in which the task will be executed. If necessary, you can specify a specific day (month or week) of execution from the beginning of the month/week or the end.

Usage - if set, the task will be executed according to the schedule.

Predefined - if set, the task is a predefined task.

Number of repetitions at crash- indicates the number of retries in case of abnormal termination.

Retry interval on abnormal termination - specifies the retry interval upon abnormal termination. Examples

Creating a background job “Full-text search index update”:

BackgroundTasks.Run("UpdatingFullTextSearchIndex");

Creating a routine task “Recovery of sequences”:

Schedule = New ScheduleTask; Schedule.PeriodRepeatDays = 1; Schedule.RepeatPeriodDuringDay = 0;

Task = RoutineTasks.CreateRoutineTask("Restoring Sequences"); Job.Schedule = Schedule; Task.Write();

Job Console

Processing with ITS, manages routine tasks:

Working with routine tasks

Job Objects

Job objects are not referenced, but are stored in the database in some special storage.

If the "Predefined" flag is enabled in the metadata, then such an object is created automatically when 1C:Enterprise is launched and always exists in exactly one instance. Such an object cannot be deleted.

If the "Predefined" flag is not set, then objects of such a task are created and deleted programmatically, specifying the schedule and parameters.

Getting a list of tasks

The list of tasks can be obtained using the method Get RoutineTasks global job manager RoutineTasks

ScheduledJobsManager

Get ScheduledJobs (GetScheduledJobs)

Syntax:

GetRegularTasks(<Отбор>)

Options:

<Отбор>(optional)

Type: Structure. Structure defining selection. Structure values ​​can be: UniqueIdentifier, Key, Metadata, Predefined, Usage, Name. If selection is not specified, all routine tasks are obtained.

If you are filtering by metadata, then as the Metadata value you can specify either the metadata object of the routine task or its name.

Return value:

Type: Array.

Description:

Receives an array of routine tasks for a given selection. Receiving scheduled tasks is only possible for the administrator.

Availability:

Routine = RoutineTasks.GetRoutineTasks(Selection);

For Each Routine of Routine Cycle NewLine = List of RoutineTasks.Add(); NewRow.Metadata = Regular.Metadata.View(); NewLine.Name = Regular.Name; NewString.Key = Regular.Key; NewLine.Schedule = Schedule.Schedule; NewLine.User = Regular.UserName; NewString.Predefined = Regular.Predefined; NewString.Use = Regular.Use; NewString.Identifier = Regular.UniqueIdentifier;

LastTask = Regular.LastTask; If LastTask<>Undefined Then NewRow.Running = LastTask.Start; NewRow.State = LastTask.State; endIf; EndCycle;

Creation

Created by the Create RoutineTask method for the manager of routine tasks:

RoutineTask = RoutineTasks.CreateRoutineTask(MetadataSelection);

RegularTask.Name = Name; RegularTask.Key = Key; RegularTask.Use = Usage; RoutineTask.UserName = UsersSelection; RoutineTask.Number ofRepetitionsAtEmergencyCompletion =NumberofRepetitionsAtEmergencyCompletion; ScheduledTask.RepeatIntervalAtEmergencyCompletion = RetryIntervalAtEmergencyCompletion; ScheduleTask.Schedule = Schedule; RegularTask.Record();

TaskObject = RoutineTasks.CreateRoutineTask("ExchangeExchange");

TaskObject.Name = Name; JobObject.Use = True;

The task object has a "Parameters" field in which the method parameters are set:

ScheduledJob

Options(Parameters)

Usage:

Read and write.

Description:

Type: Array. An array of parameters for a scheduled task. The number and composition of parameters must correspond to the parameters of the routine task method.

Availability:

Server, fat client, outer join.

Note:

Read and write capabilities are available only to the administrator.

Removal

Deleted using the Delete() method of the task object:

ScheduledTask.Delete();

Getting a Job Object

  • list via the GetRoutineTasks method:

Routine = RoutineTasks.GetRoutineTasks(Selection);

  • via the FindByUniqueIdentifier of the task manager method:

Task = ScheduledTasks.FindByUniqueIdentifier(UID);

Periodic cleaning of registers (for example, the “Object Versions” information register in the SCP configuration), performing calculations according to a schedule, completing documents in certain time- not far full list actions that can be implemented using 1C regulatory tasks.

Create a task

We do not aim to describe the code executable module, we will show general principles functioning and creation of a regulatory task.

The routine task is irreplaceable:

  1. If in the task at hand there is a need as one of the conditions periodic execution a specific algorithm;
  2. If the code must be executed regardless of the actions of operators and users of the database;
  3. If the execution of the executable procedure does not depend on external events events occurring with information base objects.

To create it, you need to go to the information base in the “Configurator” mode. Next, find the “Routine tasks” branch in the configuration tree, they are located on the “General” tab and click the “Add” button (Fig. 1)

Let's take a closer look at its properties window (Fig. 2):
Fig.2

  1. Name, synonym and comment - the rules and principles for filling out these fields are similar for all configuration objects and there is no need to describe them again;
  2. Method name – a procedure of the general module that describes the required algorithm as accurately as possible (clicking on the select button opens the available procedures, the representation of which consists of the name of the general module and the name of the procedure in various columns of the table);
  3. The key determines not so much the uniqueness of the regulatory task, but the uniqueness background process, launched based on a job, has a length limit;
  4. Schedule – we will devote a separate paragraph of our article to the description of this element;
  5. Usage – checking this box determines the activity of the task, TRUE means that the task will be launched and executed according to the schedule;
  6. Predefined – if an element has this checkbox, these tasks cannot be deleted; they are created automatically when the configuration is saved to the database;
  7. Number of repetitions - if an exception occurs during execution, it will be restarted, so that an endless loop does not occur, the program limits the number of restarts;
  8. Retry interval – time in seconds between restarts of abnormally completed tasks.

Let's take a closer look at the schedule.

Schedule of routine task

Fig.3

First of all, you should pay attention to the bottom part of the window, this is where the detailed information with a breakdown of how often and at what time the task will be performed.

“General” tab:

  • Task start date;
  • Processing end date;
  • Frequency of task repetition.

If no dates are specified on this tab, then no deadline will be set for the task.

“Daily” tab (Fig. 4)
Fig.4

In addition to the input fields for the start and end time of the task and the frequency of its launch during the day, it contains tabular part For detailed settings frequency of execution.

The “Daily” and “Weekly” tabs contain information for the corresponding periods.

Features of operation

In the client-server version of work, the execution of routine tasks is determined by the server tools. From the administration console, you can enable or disable the ability to run tasks for a specific database.

The situation is much more complicated with the file version of work. Before a certain platform release, background and routine procedures were performed only if, when the system started, defined by user The ExecuteTaskProcessing() method has been activated. In this case, the algorithms were periodically launched as long as the user who initiated the method was in the program.

Currently, the work of background jobs in the file mode of operation is evenly distributed among users authorized in the database, if the program was launched with additional parameter AllowExecuteSheduledJobs, this process will be responsible for routine maintenance.

You can completely disable background and routine work in a database running in file mode by deleting or renaming the DoNotCopy.txt file in the folder with the database. The presence of this file tells the platform that the work is being done in the original and not in a copy of the database.

Besides, in standard supplies 1C, it became possible to manage scheduled work directly from the program, without going to the “Configurator”. In the “ZUP” configuration, version 3.1.3.223, you can open the management form from the menu Administration->Maintenance->Routine operations->Routine and background tasks (Fig. 5)
Fig.5

The form that opens has an intuitive clear interface and allows:


You can also start a task directly from the form.

Some tasks in document management and accounting may need to be performed periodically. For example, on the twentieth. Or daily.

Typically, a company tries to create rules for performing such tasks - who, when and how should complete the task, who should control it.

Such tasks are called regulated, that is, performed in accordance with regulations.

In IT, monitoring is often performed in a regulated manner.

It's familiar system administrator- There is special programs, which periodically check the performance of servers and network infrastructure and report SMS or by email administrator.

Similar things exist for webmasters - to check the availability of the site during the day.

In 1C, monitoring tasks and any other periodic tasks that should be performed automatically according to a schedule are performed using the 1C Scheduled Tasks mechanism.

Let's talk about them today.

Scheduled tasks 1C

Scheduled tasks 1C are those that allow you to perform them as they do, but on a schedule.

The 1C routine task itself in the configurator is a way to specify settings and set a schedule. By the way, the schedule can be changed dynamically later in 1C Enterprise mode.

Background jobs can be created from program text in the 1C language arbitrarily without a scheduled 1C job - for parallel computing on server.

The execution of routine 1C tasks can be disabled temporarily - in.

Adding a 1C routine task

Routine 1C tasks are located in the configuration in the General/Routine 1C tasks branch. Let's add a new 1C regulatory task and indicate its name.

In the property of the 1C routine task, the Method name is indicated, just as in. The function will be located in a common module with the Server checkbox checked in the properties, that is, the module must be added in advance.

The 1C scheduled task property - Task name - determines the name under which the task will appear in task management tools.

The 1C routine task property – Key – allows you to group several different 1C routine tasks. Only one job can be started at a time with the same value key The value itself can be arbitrary. An empty value is not taken into account during control (that is, it is considered empty).

The property of a 1C routine task - Predefined - determines that when 1C Enterprise is launched, such a task will be created in a single copy with the schedule specified in the configurator. Non-predefined tasks appear programmatically at the time of the schedule.

In typical configurations, for example Accounting edition 2.0, such routine 1C tasks as Configuration Update and Recalculation of Totals are predefined, but such as Data Exchange or Deferred Movements are not predefined.

Usage – enables the task (that is, it will only be executed if the Usage checkbox is checked).

Retry on abnormal termination - as you might guess, means restarting the task if it could not complete successfully the first time - you can specify how many times to restart and how long after the abnormal termination.

1C routine task management and monitoring

To manage routine 1C tasks, there is a special standard processing Job Console. It can also be found on.

This processing belongs to the so-called universal external standard 1C processing, which is often not included in the configuration, but is distributed separately, for example, on ITS disks.

Using job console processing you can:

  • Enable/disable execution of routine 1C task
  • Assign/change the schedule of a scheduled 1C task (and other parameters)
  • Specify the 1C user on whose behalf the routine 1C task will be performed
  • See what tasks were completed when and with what result, errors in completing 1C tasks
  • Perform a task.

Copies of databases and 1C routine tasks

If you use server 1C, then the following situation occurs:

  • For your own purposes (for example, for programming), a copy of the working database is made
  • Working, testing, etc. in a copy of the database
  • You forget to turn off routine 1C tasks in such a test database.

While 1C routine tasks perform tasks related only to their information base, there is nothing in it.

However, 1C routine tasks can often save any files, data to other databases, conduct exchanges, and send emails.

In this case, you may get an interesting mixture between the result of performing routine 1C tasks in the working database and copies.

Routine 1C tasks for copies of the working database must be disabled in .

Fulfillment and non-fulfillment of 1C regulatory tasks

When creating routine 1C tasks, you must remember:

  • Tasks are performed by themselves - they need to be monitored
  • Tasks are executed in a module on the server
  • Tasks are performed under a different Windows user, with different rights.

First, you need to check that the task is being performed and can be completed as a routine 1C task.

Secondly, the server module means that many things that are available on the client are not available. For example, sometimes, not all documents can be posted only on the server, since their algorithm may provide that the posting is started manually by the user and non-server functions can be used, for example
Warning("Hello!")

Thirdly, if the task deals with something outside the 1C database, then rights become important Windows user, under which the task is executed.

The third point is especially important when developing. If the module cannot be executed on the server, the task will not be executed at all. To check, you need to run the task at least once and see the result “Task Completed” in the Task Console processing.

Scheduled tasks in 1C are designed to perform certain procedures on a schedule, with some frequency.

Routine tasks are stored in the information base and have a launch schedule. The launch itself is carried out completely automatically if the information base operating mode is client-server. If the database is file-based, then you need to perform the following steps:

  • allocate a special user to perform routine tasks;
  • a database must be opened under this user, in which the function must be periodically executed ExecuteTaskProcessing().

Creating a routine task

Scheduled tasks are a 1C configuration metadata object. Located in the General group. Let's consider the parameters and properties of scheduled tasks.

Method name— path to the export procedure in the general module, which will be executed according to a given schedule. The procedure must be performed on the server. In this respect, routine tasks are somewhat similar to an object Subscribe to the event.

Key— allows you to create several routine tasks of the same type. For example, performing data synchronization between several information bases can be implemented using a single metadata object RoutineTask, while several routine tasks themselves will be created (according to the number of databases for exchange). These routine tasks will be differentiated using the property Key. Only one job with the same key can be executed at a time.

Usage— a flag indicating whether the scheduled task is enabled.

Predetermined— here we can draw an analogy with predefined directory elements. Predefined elements are created in the configurator and used by users in their work. Regular elements the user creates it himself. It’s the same with routine tasks: if it’s predefined, then it exists and can be executed according to a schedule immediately after creation in the configurator. If the flag Predetermined is not installed, then the user needs to create one or more routine tasks himself of this type(for example, via Job Console).

Number of retries when a job terminates abnormally— determines how many times a background job will be restarted if it was completed with an error.

Retry interval when job terminates abnormally— determines how often the background job will be restarted if it was completed with an error.

Program work with routine tasks

In these examples we will consider working with ordinary, non-predefined, routine tasks.

Programmatic creation of a routine task

//Create a task
"RegularTaskName") ;

//Set the key for the scheduled task (optional)
Exercise. Key = "TaskKey" ;

//Enable routine task
Exercise. Usage = True ;

//Write a routine task
Exercise. Write() ;

Programmatic receipt of a scheduled task for changing parameters

In this example, assume that there is only one routine task of a given type. If there are several tasks, then, knowing , it is not difficult to make appropriate changes to the code.


"RoutineTaskName"] ) ) ;


If Tasks. Quantity() > 0 Then
Job= Jobs[ 0 ] ;


Otherwise
Task = RegularTasks. Create RoutineTask( "RoutineTaskName") ;

EndIf ;

//The routine task is in the Task variable. You can change its parameters.

Calling the dialog for changing the schedule of a routine task

There is a special type of dialogue for working with the schedule of a routine task. We still assume that we have only one routine task of this type.

//Get an array with routine tasks of the required type
Tasks = Regular Tasks. Get RoutineTasks(new Structure("Metadata" , Metadata. RoutineTasks[ "RoutineTaskName"] ) ) ;

//If the task exists, then by condition it is one
If Tasks. Quantity() > 0 Then
Job= Jobs[ 0 ] ;

//If there is no task, create it
Otherwise
Task = RegularTasks. Create RoutineTask( "RoutineTaskName") ;

EndIf ;

Schedule=Task. Schedule;

//Create a dialog for changing the schedule of a routine task
Editing Dialog = New ScheduleDialog of RoutineTask (Schedule) ;

//Show the dialog to the user and process schedule changes
IfEditDialog. OpenModal() Then
Exercise. Schedule = EditDialog. Schedule;
Exercise. Write() ;
EndIf ;

It has long been noted that success is achieved only by those who know what they are striving for and what they are doing. To achieve your goals, you need to successfully complete assigned tasks and know specified functions. Are these concepts identical or is there some difference between them? Why is it so important to know exact value of these categories and what threatens their substitution and confusion?

Definition

Task- this is a problem that requires resolution using available means, an order that needs to be completed by a specified deadline. It can be any question facing a person, be it a complex scientific problem (a cure for cancer) or a relatively minor difficulty (building a road). The performer is limited by the set of resources that he has at his disposal.

Function- the activity of a person or mechanism aimed at achieving a certain result, the role and purpose of the object inside separate system. Each thing has a specific function: tools are used to produce and process products, objects of art are used to satisfy aesthetic needs, computers are used to collect and store information.

Comparison

What is the difference between a function and a task? So, both tasks and functions are assigned to a person either by a leader, manager, or independently. However, the categories differ from each other in the final result which a person must achieve. The function is performed continuously or periodically (water delivery to residential buildings), and the result can only be measured in a certain unit of time. Problems have a completely different quality: each of them either has a specific solution (one or several), or it does not exist (an unsolvable problem).

A certain function can be performed either by a person (repairing a heating main, setting up Internet access) or by a mechanism or program (checking the integrity of a pipeline, water purification). A task is always faced by a being endowed with consciousness; to solve it it is necessary to use knowledge or experience. Inanimate objects and mechanisms perform routine tasks, only performing its functions.

A task consists of such mandatory elements as a controversial situation, a problem and a solution. If it is not possible to answer a challenge, it is considered unsolvable. A function is a process that includes rules, an algorithm of actions and an expected result. Violation of the given sequence will make implementation impossible. The goal can be achieved different ways, including in new ways.

At the same time, to implement tasks and perform functions, resources (material, labor) are required, which may be sufficient, insufficient or excessive. The performer's freedom of action is limited by certain rules, violation of which entails negative consequences. Tasks and functions are necessary to achieve global goals set for a person, working group, society.

Conclusions website

  1. Result. A task has a specific solution, while a function does not and must be executed continuously.
  2. Ratio. The concept of “task” is extremely broad: several functions can be used to achieve one goal.
  3. Executor. Only a creature endowed with intelligence can solve a problem, perform a function - any mechanism.
  4. Hierarchy. Functions serve to implement the tasks assigned to individuals and society.
  5. Compound. The task includes a plot (description of the situation), a problem and a solution. Function – algorithm of actions and result.