CN108459889B - Task execution method and device, storage medium and electronic device - Google Patents

Task execution method and device, storage medium and electronic device Download PDF

Info

Publication number
CN108459889B
CN108459889B CN201810064392.6A CN201810064392A CN108459889B CN 108459889 B CN108459889 B CN 108459889B CN 201810064392 A CN201810064392 A CN 201810064392A CN 108459889 B CN108459889 B CN 108459889B
Authority
CN
China
Prior art keywords
task
execution
target task
state
target
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201810064392.6A
Other languages
Chinese (zh)
Other versions
CN108459889A (en
Inventor
程凌宇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN201810064392.6A priority Critical patent/CN108459889B/en
Publication of CN108459889A publication Critical patent/CN108459889A/en
Application granted granted Critical
Publication of CN108459889B publication Critical patent/CN108459889B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Stored Programmes (AREA)
  • Telephonic Communication Services (AREA)

Abstract

The invention discloses a task execution method and device, a storage medium and an electronic device, wherein the task execution method comprises the following steps: acquiring a task switch instruction, wherein the task switch instruction is used for indicating whether to allow a target task in a target service to be executed; setting the execution state of the target task to a state in which execution is not allowed in the case where the task switch instruction indicates that execution of the target task is not allowed; and skipping the execution of the target task when the trigger condition of the target task is satisfied and the execution state of the target task is a state in which the execution is not allowed. The invention solves the technical problem that the execution state of part of tasks cannot be flexibly adjusted during the external service period of the server in the related art.

Description

Task execution method and device, storage medium and electronic device
Technical Field
The present invention relates to the field of computers, and in particular, to a task execution method and apparatus, a storage medium, and an electronic apparatus.
Background
During external service, the server often needs to flexibly adjust the execution state of a certain service or a certain task in the service at any time according to the conditions of operation or sudden failure and the like, for example, registration is allowed, and registration is not allowed; allow payment, disallow payment, etc. And during the adjustment of the execution state, the overall service capability of the server is not expected to be influenced, and the execution process of other businesses or tasks in the server is not expected to be influenced. However, there is no unified way to dynamically adjust the execution status of the part of the tasks of the server that is being served externally in the related art.
In view of the above problems, no effective solution has been proposed.
Disclosure of Invention
The embodiment of the invention provides a task execution method and device, a storage medium and an electronic device, and aims to at least solve the technical problem that the execution state of part of tasks cannot be flexibly adjusted during the external service period of a server in the related art.
According to an aspect of an embodiment of the present invention, there is provided a task execution method including: acquiring a task switch instruction, wherein the task switch instruction is used for indicating whether to allow a target task in a target service to be executed; setting the execution state of the target task to a state in which execution is not allowed in the case where the task switch instruction indicates that execution of the target task is not allowed; and skipping the execution of the target task when the trigger condition of the target task is met and the execution state of the target task is a state not allowing the execution.
According to another aspect of the embodiments of the present invention, there is also provided a task execution device, including: the system comprises an acquisition unit, a processing unit and a processing unit, wherein the acquisition unit is used for acquiring a task switch instruction, and the task switch instruction is used for indicating whether to allow a target task in a target service to be executed or not; a first setting unit configured to set an execution state of the target task to a state in which execution is not permitted, in a case where the task switch instruction indicates that execution of the target task is not permitted; and the first execution unit is used for skipping the execution of the target task when the trigger condition of the target task is met and the execution state of the target task is a state which is not allowed to be executed.
According to another aspect of the embodiments of the present invention, there is also provided a storage medium, in which a computer program is stored, wherein the computer program is configured to execute any one of the task execution methods in the embodiments of the present invention when the computer program runs.
According to another aspect of the embodiments of the present invention, there is also provided an electronic apparatus, including a memory and a processor, where the memory stores therein a computer program, and the processor is configured to execute any one of the task execution methods according to the embodiments of the present invention by using the computer program.
In the embodiment of the invention, by acquiring the task switch instruction, under the condition that the task switch instruction indicates that the target task is not allowed to be executed, the execution state of the target task is set to be a state which is not allowed to be executed, and under the condition that the trigger condition of the target task is met and the execution state of the target task is detected to be the state which is not allowed to be executed, the execution of the target task is skipped, so that the aim of flexibly adjusting the execution state of the target task is achieved, the technical problem that the execution state of part of tasks cannot be flexibly adjusted during the external service of the server in the related art is solved, and the technical effect of improving the adjustment efficiency of the task execution state is achieved.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the invention and together with the description serve to explain the invention without limiting the invention. In the drawings:
FIG. 1 is a schematic diagram of a hardware environment for a task execution method according to an embodiment of the invention;
FIG. 2 is a flow diagram of an alternative method of task execution according to an embodiment of the invention;
FIG. 3 is a flow chart of an alternative instruction sending method according to an embodiment of the invention;
FIG. 4 is a schematic diagram of a function switch command issuing process in accordance with a preferred embodiment of the present invention;
FIG. 5 is a schematic diagram of a functional module dynamic switching process in accordance with a preferred embodiment of the present invention;
FIG. 6 is a schematic diagram of an alternative task performing device according to an embodiment of the present invention; and
fig. 7 is a block diagram of an electronic device according to an embodiment of the invention.
Detailed Description
In order to make the technical solutions of the present invention better understood, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It should be noted that the terms "first," "second," and the like in the description and claims of the present invention and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the invention described herein are capable of operation in sequences other than those illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
According to an aspect of an embodiment of the present invention, there is provided a task execution method.
Alternatively, in the present embodiment, the task execution method described above may be applied to a hardware environment formed by the server 102 and the terminal 104 as shown in fig. 1. As shown in fig. 1, a server 102 is connected to a terminal 104 via a network including, but not limited to: the terminal 104 is not limited to a PC, a mobile phone, a tablet computer, etc. in a wide area network, a metropolitan area network, or a local area network. The task execution method according to the embodiment of the present invention may be executed by the server 102, where the server 102 may be in the period of being served externally when executing the task execution method according to the embodiment of the present invention, and the task execution method according to the embodiment of the present invention may implement flexible adjustment of a certain service in the server 102 being served externally or an execution state of a certain task in a certain service, for example, to allow or disallow execution of a certain task.
Fig. 2 is a flowchart of an alternative task execution method according to an embodiment of the present invention, which may include the following steps, as shown in fig. 2:
step S202, a task switch instruction is obtained, wherein the task switch instruction is used for indicating whether a target task in a target service is allowed to be executed or not;
step S204, under the condition that the task switch instruction indicates that the target task is not allowed to be executed, setting the execution state of the target task to be a state that the execution is not allowed;
in step S206, when it is detected that the trigger condition of the target task is satisfied and the execution state of the target task is a state in which execution is not permitted, execution of the target task is skipped.
Through the steps S202 to S206, the task switch instruction is obtained, the execution state of the target task is set to the state that the execution is not allowed when the task switch instruction indicates that the target task is not allowed to be executed, and the execution of the target task is skipped when it is detected that the trigger condition of the target task is met and the execution state of the target task is the state that the execution is not allowed, so that the purpose of flexibly adjusting the execution state of the target task is achieved, and further, the technical problem that the execution states of part of tasks cannot be flexibly adjusted during the external service period of the server in the related art is solved, thereby achieving the technical effect of improving the efficiency of adjusting the execution state of the tasks.
In the technical solution provided in step S202, the server 102 of the external server may include one or more services, where the target service may be any one of the one or more services. Each business may include one or more tasks, wherein a target task may be any one of the one or more tasks. In the server 102, a service identifier may be allocated to each service, where the service identifier may be used to uniquely identify one service, and similarly, in the server 102, a task identifier may also be allocated to each task, where the task identifier may be used to uniquely identify one task. Optionally, the server 102 may also pre-configure an execution state for the task in each service, including configuring an execution state for a target task in a target service. It should be noted here that one execution state may correspond to one or more tasks. It should be further noted that the execution states of the tasks in the embodiment of the present invention may include a state in which execution is permitted and a state in which execution is not permitted. Preferably, in the embodiment of the present invention, the execution state of each task may be preset to be a state that allows execution, each task is allowed to be executed during the external service of the server 102, and when a certain task in the server 102 needs to be closed, the execution state of the task may be changed. It should be noted that, in the embodiment of the present invention, the execution state of each task may also be configured in advance according to actual requirements, and is not limited to configuring the initial execution state of each task as a state that allows execution.
The task switching instruction in the embodiment of the present invention may be used to indicate whether to allow execution of a target task in a target service, and optionally, the task switching instruction may at least include the following information: the service identification of the target service, the description parameter of the target service, the task identification of the target task, the description parameter of the target task, the parameter indicating the execution state of the target task, and the like. It should be noted here that other information may also be included in the task switch command, which is not illustrated here.
In a practical application scenario, the task switching instruction may be manually input by a user in the client, and then the client sends the task switching instruction to the server 102, where the task switching instruction input by the user in the client may include at least a service identifier for indicating a target service, an identifier for indicating a target task, a parameter for indicating an execution state of the target task, and the like. In order to improve the transmission safety of the task switching instruction, the embodiment of the invention can compress and package the task switching instruction input by the user in the client according to the preset protocol and then send the compressed and packaged task switching instruction to the server, namely the task switching instruction received by the server is the task switching instruction packaged according to the preset protocol. Optionally, when the user inputs the task switching command, the task switching command may be compressed and packaged according to an actually used transmission protocol and file format, where the transmission protocol and file format used between the client and the server 102 are not specifically limited. Optionally, in order to improve transmission security of the task switch instruction, when the task switch instruction is compressed and packaged according to a predetermined protocol, the embodiment of the present invention may further perform encryption, so as to further improve transmission security of the task switch instruction.
As an alternative embodiment, after acquiring the task switch command, the alternative embodiment may further include: analyzing the task switch instruction to obtain the description information of the target task and the execution state of the target task; and establishing a mapping relation between the description information of the target task and the execution state of the target task.
It should be noted that the description information of the target task and the execution state of the target task may be obtained by analyzing the task switch command, where the description information of the target task may include, but is not limited to, a task identifier of the target task, a description parameter of the target task, and the like, and the execution state of the target task may include, but is not limited to, a parameter for indicating the execution state of the target task, and the like.
After the description information of the target task and the execution state of the target task are acquired, the optional embodiment may establish a mapping relationship between the description information of the target task and the execution state of the target task. Optionally, establishing a mapping relationship between the description information of the target task and the execution state of the target task may include: constructing description information of a target task into a character array; performing hash calculation on the character array to obtain a hash value; and establishing a mapping relation between the hash value and the execution state of the target task.
It should be further noted that, in this embodiment, the service node for processing the target service analyzes the task switch instruction, and a specific process of establishing a mapping relationship between the description information of the target task and the execution state of the target task may call an application program interface API for setting the execution state to execute, where the API may execute the execution flow in the optional embodiment. The optional embodiment can realize the setting of the execution state of the target task by calling the application program interface API for setting the execution state, so that when the execution state of other tasks needs to be set or the execution state of the target task needs to be changed, the application program interface API for setting the execution state is only needed to be changed, the execution flow of the target service does not need to be changed, the workload of developers for developing the target service can be reduced, and the adjustment efficiency of the execution state of the target task can be improved.
According to the optional embodiment, the description information of the target task and the execution state of the target task are obtained, and the mapping relation between the description information of the target task and the execution state of the target task is established, so that the purpose of conveniently and quickly searching the execution state of the target task according to the description information of the target task in the follow-up process can be achieved, the adjustment time of the execution state of the target task is shortened, and the effect of improving the adjustment efficiency of the execution state of the target task is achieved.
In the technical solution provided in step S204, after the server 102 obtains the task switch instruction, the server 102 may analyze the task switch instruction to locate the target service first, and after receiving the task switch instruction, the server 102 may send the task switch instruction to a corresponding service node object that processes the target service, and after receiving the task switch instruction, the service node object may analyze the task switch instruction to obtain an identifier of the target task and a parameter indicating an execution state of the target task, and set the execution state of the target task according to the parameter indicating the execution state of the target task. Specifically, in the case where the task switch instruction indicates that the target task is not permitted to be executed, the execution state of the target task may be set to a state in which execution is not permitted; in the case where the task switch instruction indicates permission of execution of the target task, the execution state of the target task may be set to a state in which execution is permitted.
In the technical solution provided in step S206, a service node object for processing a target service may detect whether a trigger condition of a target task is met in real time in a process of executing the target service, and when the trigger condition of the target task is detected to be met, an execution state of the target task may be detected first before a specific process of executing the target task is executed, and if the execution state of the target task is a state that is not allowed to be executed, the execution of the target task is skipped; and if the execution state of the target task is the state allowing execution, executing the target task.
In the case that the trigger condition of the target task is detected to be satisfied, the execution state of the current target task may be detected by the following alternative embodiments.
As an optional embodiment, when it is detected that the trigger condition of the target task is met and the execution state of the target task is a state in which execution is not allowed, skipping execution of the target task may specifically include: acquiring description information of a target task; acquiring an execution state of a target task having a mapping relation with description information of the target task; when the execution state of the target task is a state in which execution is not permitted, execution of the target task is skipped.
It should be noted that, before the target task is executed, the alternative embodiment first obtains the description information of the target task, where the description information of the target task may include, but is not limited to, an identifier of the target task, a description parameter of the target task, and the like. After the description information of the target task is obtained, the optional embodiment may search the execution state corresponding to the description information of the current target task by using the mapping relationship established in the optional embodiment.
Optionally, the obtaining of the execution state of the target task having the mapping relationship with the description information of the target task may include: constructing description information of a target task into a character array; carrying out hash calculation on the character array to obtain a hash value; and acquiring the execution state of the target task having the mapping relation with the hash value. The mapping relationship here may be the mapping relationship already established in the above embodiment, and the execution state of the current target task is directly searched through the already established mapping relationship, so that the time for acquiring the execution state of the target task can be shortened, and the efficiency of adjusting the execution state of the target task is further improved.
It should be further noted that, the specific procedure in this alternative embodiment may call an application program interface API for checking the execution state to execute, and here, it should be noted that the application program interface API for checking the execution state in this alternative embodiment may not be the same as the application program interface API for setting the execution state in the above alternative embodiment of the present invention. The API for setting the execution state in the above optional embodiment of the present invention is mainly used to set the execution state of the target task according to the task switch instruction, and establish the mapping relationship of the index; the application program interface API for checking the execution state in this alternative embodiment is mainly used to find the execution state of the current target task according to the already established mapping relationship.
The optional embodiment can call the application program interface API for checking the execution state to quickly acquire the execution state of the target task, so that the purpose of flexibly searching the execution state of any task can be realized on the basis of not changing the execution flow of the target service, and the effect of improving the efficiency of adjusting the execution state of the target task is further achieved.
According to another aspect of the embodiment of the invention, an instruction sending method is also provided.
Alternatively, in the present embodiment, the above-described instruction transmission method may also be applied to a hardware environment formed by the server 102 and the terminal 104 as shown in fig. 1. The instruction sending method according to the embodiment of the present invention may be executed by the server 102. It should be noted that the task execution method and the instruction sending method in the embodiment of the present invention may be executed by different node units in the server 102, for example, the instruction sending method may be executed by a central control node in the server 102, and the task execution method may be executed by a service node in the server 102. By the instruction sending method and the task executing method of the embodiment of the invention, it is possible to flexibly adjust a certain service in the server 102 that is serving externally or the execution state of a certain task in a certain service, for example, to allow or disallow a certain task to be executed.
Fig. 3 is a flowchart of an alternative instruction sending method according to an embodiment of the present invention, and as shown in fig. 3, the method may include the following steps:
step S302, a first task switch instruction is obtained, wherein the first task switch instruction is used for indicating that the target task in the target service is not allowed to be executed;
step S304, sending the first task switch instruction to the object executing the target task in the target service, so as to instruct the object to set the execution state of the target task to a state that the execution is not allowed, and skipping the execution of the target task when it is detected that the trigger condition of the target task is satisfied and the execution state of the target task is the state that the execution is not allowed.
Through the above steps S302 to S304, the obtained first task switch instruction is sent to the object executing the target task in the target service to indicate that the object sets the execution state of the target task to the state that the execution is not allowed when the first task switch instruction indicates that the target task is not allowed to be executed, and when it is detected that the trigger condition of the target task is met and the execution state of the target task is the state that the execution is not allowed, the execution of the target task is skipped, so that the purpose of flexibly adjusting the execution state of the target task is achieved, and further, the technical problem that the execution states of some tasks cannot be flexibly adjusted during the external service of the server in the related art is solved, thereby achieving the technical effect of improving the efficiency of adjusting the task execution state.
In the technical solution provided in step S302, the server 102 of the external server may include one or more services, where the target service may be any one of the one or more services. Each business may include one or more tasks, wherein a target task may be any one of the one or more tasks. In the server 102, a service identifier may be allocated to each service, where the service identifier may be used to uniquely identify one service, and similarly, in the server 102, a task identifier may also be allocated to each task, where the task identifier may be used to uniquely identify one task. Optionally, the server 102 may also pre-configure an execution state for the task in each service, including configuring an execution state for a target task in a target service. It should be noted here that one execution state may correspond to one or more tasks. It should be further noted that the execution states of the tasks in the embodiment of the present invention may include a state in which execution is permitted and a state in which execution is not permitted. Preferably, in the embodiment of the present invention, the execution state of each task may be preset to be a state that allows execution, each task is allowed to be executed during the external service of the server 102, and when a certain task in the server 102 needs to be closed, the execution state of the task may be changed. It should be noted that, in the embodiment of the present invention, the execution state of each task may also be configured in advance according to actual requirements, and is not limited to configuring the initial execution state of each task as a state that allows execution.
The first task switching instruction in the embodiment of the present invention may be used to indicate that a target task in a target service is not allowed to be executed, and optionally, the first task switching instruction may include at least the following information: the service identification of the target service, the description parameter of the target service, the task identification of the target task, the description parameter of the target task, the parameter indicating the execution state of the target task, and the like. It should be noted that, other information may also be included in the first task switch command, which is not illustrated here.
In an actual application scenario, the first task switching instruction may be manually input by a user in the client and then sent to the service node through the central control node, where the task switching instruction input by the user in the client may include at least a service identifier for indicating a target service, an identifier for indicating a target task, and a parameter for indicating an execution state of the target task. The central control node may compress and package a task switch instruction input by a user at the client according to a predetermined protocol, and send the compressed and packaged task switch instruction to a service node in the server, that is, an object for executing a target task in a target service in the embodiment of the present invention. Optionally, when compressing and packaging the task switch instruction input by the user, the central control node may compress and package according to an actually used transmission protocol and file format, where the transmission protocol and file format used between the client and the server 102 are not specifically limited.
As an alternative embodiment, after acquiring the first task switch command, the alternative embodiment may further include: and packaging the first task switching instruction according to a preset protocol to obtain a packaged first task switching instruction. It should be noted here that the alternative embodiment does not specifically limit the predetermined protocol, for example, the predetermined protocol may be xml, json, protobuf, or the like. Optionally, when the first task switch command is packaged according to a predetermined protocol, the optional embodiment may further perform encryption processing on the first task switch command, the optional embodiment also does not specifically limit the technical means used for encryption, and the security of the first task switch command in the transmission process may be improved by encryption.
In the technical solution provided in step S304, after the packed first task enable is acquired, the embodiment of the present invention may send the packed first task switch instruction to an object in the server 102, which executes a target task in the target service. After receiving the first task switch instruction, the object may perform the following process, specifically: and setting the execution state of the target task to be a state of not allowing execution, and skipping the execution of the target task when the condition that the trigger condition of the target task is met and the execution state of the target task is the state of not allowing execution is detected.
As an alternative embodiment, after acquiring the first task switch command, the alternative embodiment may further include: analyzing the first task switch instruction to obtain the description information of the target task and the execution state of the target task; and establishing a mapping relation between the description information of the target task and the execution state of the target task.
It should be noted that the description information of the target task and the execution state of the target task may be obtained by analyzing the first task switch command, where the description information of the target task may include, but is not limited to, a task identifier of the target task, a description parameter of the target task, and the like, and the execution state of the target task may include, but is not limited to, a parameter for indicating the execution state of the target task, and the like.
After the description information of the target task and the execution state of the target task are acquired, the optional embodiment may establish a mapping relationship between the description information of the target task and the execution state of the target task. Optionally, establishing a mapping relationship between the description information of the target task and the execution state of the target task may include: constructing description information of a target task into a character array; carrying out hash calculation on the character array to obtain a hash value; and establishing a mapping relation between the hash value and the execution state of the target task.
It should be further noted that, in this embodiment, an object that executes a target task in the target service (that is, a service node object for processing the target service in the foregoing embodiment of the present invention) parses the first task switch instruction, and a specific process that establishes a mapping relationship between description information of the target task and an execution state of the target task may call an application program interface API that sets the execution state to execute, where the API may execute the execution flow in the foregoing optional embodiment. The optional embodiment can realize the setting of the execution state of the target task by calling the application program interface API for setting the execution state, so that when the execution state of other tasks needs to be set or the execution state of the target task needs to be changed, the application program interface API for setting the execution state is only needed to be changed, the execution flow of the target service does not need to be changed, the workload of developers for developing the target service can be reduced, and the adjustment efficiency of the execution state of the target task can be improved.
According to the optional embodiment, the description information of the target task and the execution state of the target task are obtained, and the mapping relation between the description information of the target task and the execution state of the target task is established, so that the purpose of conveniently and quickly searching the execution state of the target task according to the description information of the target task in the follow-up process can be achieved, the adjustment time of the execution state of the target task is shortened, and the effect of improving the adjustment efficiency of the execution state of the target task is achieved.
After receiving the first task switching instruction, the object executing the target task in the target service may analyze the first task switching instruction to obtain the identifier of the target task and the parameter indicating the execution state of the target task, and set the execution state of the target task according to the parameter indicating the execution state of the target task. Specifically, in the case where the first task switch instruction indicates that the target task is not permitted to be executed, the execution state of the target task may be set to a state in which the execution is not permitted.
The method comprises the steps that an object for executing a target task in a target service can detect whether a trigger condition of the target task is met or not in real time in a process of executing the target service, when the trigger condition of the target task is detected to be met, an execution state of the current target task can be detected firstly before a specific process of executing the target task is executed, and if the execution state of the current target task is a state that execution is not allowed, execution of the target task is skipped.
In the case that the trigger condition of the target task is detected to be satisfied, the execution state of the current target task may be detected by the following alternative embodiments.
As an optional embodiment, when it is detected that the trigger condition of the target task is met and the execution state of the target task is a state in which execution is not allowed, skipping execution of the target task may specifically include: acquiring description information of a target task; acquiring an execution state of a target task having a mapping relation with description information of the target task; when the execution state of the target task is a state in which execution is not permitted, execution of the target task is skipped.
It should be noted that, before the target task is executed, the alternative embodiment first obtains the description information of the target task, where the description information of the target task may include, but is not limited to, an identifier of the target task, a description parameter of the target task, and the like. After the description information of the target task is obtained, the optional embodiment may search the execution state corresponding to the description information of the current target task by using the mapping relationship established in the optional embodiment.
Optionally, the obtaining of the execution state of the target task having the mapping relationship with the description information of the target task may include: constructing description information of a target task into a character array; carrying out hash calculation on the character array to obtain a hash value; and acquiring the execution state of the target task having the mapping relation with the hash value. The mapping relationship here may be the mapping relationship already established in the above embodiment, and the execution state of the current target task is directly searched through the already established mapping relationship, so that the time for acquiring the execution state of the target task can be shortened, and the efficiency of adjusting the execution state of the target task is further improved.
It should be further noted that, the specific procedure in this alternative embodiment may call an application program interface API for checking the execution state to execute, and here, it should be noted that the application program interface API for checking the execution state in this alternative embodiment may not be the same as the application program interface API for setting the execution state in the above alternative embodiment of the present invention. The API for setting the execution state in the above optional embodiment of the present invention is mainly used to set the execution state of the target task according to the task switch instruction, and establish the mapping relationship of the index; the application program interface API for checking the execution state in this alternative embodiment is mainly used to find the execution state of the current target task according to the already established mapping relationship.
The optional embodiment can call the application program interface API for checking the execution state to quickly acquire the execution state of the target task, so that the purpose of flexibly searching the execution state of any task can be realized on the basis of not changing the execution flow of the target service, and the effect of improving the efficiency of adjusting the execution state of the target task is further achieved.
As an optional embodiment, before acquiring the first task switch instruction, or after sending the first task switch instruction to an object executing a target task in the target service, the optional embodiment may further include: acquiring a second task switch instruction, wherein the second task switch instruction is used for indicating that a target task in a target service is allowed to be executed; and sending a second task switch instruction to an object executing the target task in the target service to indicate the object to set the execution state of the target task to be a state allowing execution, and executing the target task when the condition that the trigger condition of the target task is met and the execution state of the target task is the state allowing execution is detected.
It should be noted that the second task switch instruction in this embodiment may be used to indicate that the target task in the target service is allowed to be executed, and the obtaining and sending processes of the second task switch instruction are the same as those of the first task switch instruction in the foregoing embodiment of the present invention, and are not described here again. After the second task switch instruction is sent to the object executing the target task in the target service, the object may set the execution state of the target task to a state allowing execution, and execute the target task when it is detected that the trigger condition of the target task is met and the execution state of the target task is the state allowing execution. It should be noted that, the process of analyzing the second task switch instruction and searching the execution state of the current target task, which is executed after the second task switch instruction is received after the object of the target task in the target service is executed, is the same as the process of analyzing the first task switch instruction and searching the execution state of the current target task by the object of the target task in the target service in the above embodiment of the present invention, and is not described here again.
The task execution method and the instruction sending method in the embodiment of the present invention may be applied to the communication field, the game field, and the like, and the application of the present invention to the game field is taken as an example, and the present invention will be specifically described with reference to specific examples:
the invention also provides a preferred embodiment, which provides a method for realizing the dynamic switch of the functional module of the server for the whole-area whole-service game. The whole-area whole-service game server is a specific example of the server 102 in the above embodiment of the present invention, the function module is the target task in the above embodiment of the present invention, and the dynamic switch of the function module is the execution state of the adjustment target task.
As shown in fig. 4, the implementation method in the preferred embodiment introduces a central control node, and an operation and maintenance person may send a function switching instruction to other service nodes through a human-computer interaction interface of the central control node, specifically, the operation and maintenance person may input the function switching instruction through the human-computer interaction interface, and the central control node may forward the function switching instruction and send the function switching instruction to one or more service nodes in a service cluster, and it is assumed that the central control node sends the function switching instruction to the service node 2, and the service node 2 may check a switching state in a target function execution process after receiving the function switching instruction, and determine to continue execution or skip execution. The granularity of the function modules controlled is completely defined by the user himself. The function that can be switched on and off individually can be as large as an independent sub-service, such as: registration services, payment services, conference systems, etc. Or as small as whether a certain parameter is effective, such as: whether or not to allow use of a prop. It should be noted that, the central control node and the service node may be located in the game server, the central control node may be configured to execute the instruction sending method according to the embodiment of the present invention, and the service node may be configured to execute the task executing method according to the embodiment of the present invention.
It should be noted that, in an actual application scenario, a user may manually input a function switching instruction through a human-computer interaction interface of a client, and then the central control node obtains the function switching instruction input by the user and forwards the function switching instruction to a corresponding service node. Or, multiple function selections and switch selections of each function can be provided for a user in the client, the user can flexibly select which function is turned on or turned off according to actual requirements, and the central control node can generate a function switch instruction according to selection parameters of the user in the client and send the function switch instruction to the corresponding service node.
The maintenance personnel of the game server can send a function opening or closing instruction to the service node through the man-machine interaction interface, wherein the instruction can comprise the following information:
function identification code: each function that can be individually switched defines an id to identify.
Parameters are as follows: each switchable function may require one or more parameters to describe, for example, a function switch that operates an activity requires a parameter to specify an activity id; the function switch of the task system requires a parameter to specify the task id.
Switching state: 0 represents off and 1 represents on.
The switching commands passed from the central node to the service nodes may be defined using any public or proprietary protocol format, such as xml, json, protobuf, etc., as long as the above information is contained.
For example, the switch commands for daily check-in operational activities are defined as follows:
operation activity function identification code: 1001
Parameters are as follows: activity id (201: daily sign-in)
Switching state: close off
The information is defined by an xml format, and specific codes are as follows:
< | A! - -operation activity function identification code definition- - > -)
< macro name ═ E _ FUNC _ ACTIVITY "value ═ 1001" desc ═ operation ACTIVITY function identification code "/>, and
< | A! -operational activity function switch parameter >
< struct name ═ FUNC _ SWITCH _ ACTIVITY >
< entry name ═ activity _ id "type ═ int" desc ═ activity id "/>, and
</struct>
in order to enable the command of the function switch to be communicated to the relevant service node and to be effective, the technical scheme introduces a group of APIs and a central control node. The relevant APIs may include:
API for setting the state of the function switch: filling all information required by the function switch;
API to check function switch status: the information required by the function switch is filled in to obtain the state of whether the function is on or off.
The role of the central control node is: and receiving function switch information obtained by the man-machine interaction interface, and packaging and sending the function switch information to the corresponding service node according to a format defined in the protocol.
The service node calls an API for setting a function switch state in the code to receive a switch instruction about a certain function sent from the central control node, and stores switch information (including a function identifier, parameters, a switch state, and the like) carried in the instruction in a local memory.
Specifically, the algorithm for storing the switch information is as follows:
the other fields (i.e., the function identification code and all parameters) except the switch status are constructed into a character array, and the codes are as follows:
functional switch status off
int switch_status=0;
V. assigning a function identification code
int function_code=E_FUNC_ACTIVITY;
V. assigning a value to a functional switch parameter
FUNC_SWITCH_ACTIVITY activity_switch_data;
activity_switch_data.activity_id=201;
std::string key;
V. construction of character arrays by switch information
V function identification code
key.assign((char*)&function_code,sizeof(function_code));
Functional switch parameter/. + -. function switch parameter
key.append(activity_switch_data,sizeof(activity_switch_data));
Calculating the Hash (FNV Hash algorithm) of the character array to obtain a hash key, storing the switch state as value into a Hash table, wherein the code is as follows:
Figure BDA0001556221730000171
Figure BDA0001556221730000181
and calling an API for checking the switch state of the function at the logic inlet of the function to obtain the current switch state of the function. When the service runs to the logic of this function, the subsequent logic flow (execution/skipping) can be continued according to the switch state.
The algorithm to check the switch state may be: all information (function identification code and parameters) required for checking the switch state is transmitted to the API for checking the switch state of the function, the API can construct a character array by using the same method as that used in the API for setting the function switch, a hash value is calculated, and the hash value is used for searching a corresponding state value in a hash table, so that whether the function is closed at present can be known.
The function switch with finer granularity can be completely controlled by a user through parameters in the switch information, and a plurality of parameters are set for the switch information of a certain function, which indicates that the function is closed/opened when the conditions of parameter 1, parameter 2, parameter 3 and the like are met.
Example (c): setting switches for different types of stores or different commodities in different types of stores, where the switch information may be defined as follows:
store function identification code: 1002
Parameter 1
Store type (1: gold coin store, 2: diamond store)
Parameter 2
Goods id (110001: helmet, 110002: mask)
On-off state (0: off, 1: on)
Human-machine instructions: the diamond store was closed.
Store function identification code: 1002
Parameter 1: 2
Parameter 2: is not filled with
Switching state: 0
Human-machine instructions: the mask in the diamond shop is closed.
Store function identification code: 1002
Parameter 1: 2
Parameter 2: 110002
Switching state: 0
Fig. 5 is a schematic diagram of a dynamic switching process of a function module according to a preferred embodiment of the present invention, and as shown in fig. 5, the dynamic switching process of the function module may include two parts, namely a switch setting stage and a switch checking stage, respectively, where a central control node may receive a function a shutdown instruction input by a user through a human-computer interaction interface, package the instruction for shutting down the function a with a predefined protocol, and forward the packaged switch instruction to a service node a. After receiving the switch instruction forwarded by the central control node, the service node a firstly analyzes the switch information from the protocol, calculates a hash value for the switch information, and stores the switch state of the function a to complete the flow of the switch setting stage. When function a is penalized, service node a may call an API that checks the switch state to obtain that function a's current state is "off," and the logic of function a is skipped.
The preferred embodiment can be applied to the development and operation maintenance of the game server of the full-area full-service architecture. The preferred embodiment proposes a unified and universal mechanism to solve the problem of dynamic switching of the game server function module, and the game server of the preferred embodiment can be used to more quickly establish the mechanism of dynamic function switching. The technical scheme has the advantages of simple design, easy understanding and implementation, no invasion of specific business logic and strong customizability.
It should be noted that, for simplicity of description, the above-mentioned method embodiments are described as a series of acts or combination of acts, but those skilled in the art will recognize that the present invention is not limited by the order of acts, as some steps may occur in other orders or concurrently in accordance with the invention. Further, those skilled in the art should also appreciate that the embodiments described in the specification are preferred embodiments and that the acts and modules referred to are not necessarily required by the invention.
Through the above description of the embodiments, those skilled in the art can clearly understand that the method according to the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but the former is a better implementation mode in many cases. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which is stored in a storage medium (e.g., ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal device (e.g., a mobile phone, a computer, a server, or a network device) to execute the method according to the embodiments of the present invention.
According to another aspect of the embodiment of the present invention, there is also provided a task execution device for implementing the above task execution method. Fig. 6 is a schematic diagram of an alternative task execution device according to an embodiment of the present invention, and as shown in fig. 6, the device may include:
an obtaining unit 62, configured to obtain a task switch instruction, where the task switch instruction is used to indicate whether to allow a target task in a target service to be executed; a first setting unit 64 for setting the execution state of the target task to a state in which execution is not permitted in a case where the task switch instruction indicates that execution of the target task is not permitted; and a first executing unit 66 configured to skip execution of the target task when it is detected that the trigger condition of the target task is satisfied and the execution state of the target task is a state in which execution is not permitted.
It should be noted that the obtaining unit 62 in this embodiment may be configured to execute step S202 in this embodiment, the first setting unit 64 in this embodiment may be configured to execute step S204 in this embodiment, and the first executing unit 66 in this embodiment may be configured to execute step S206 in this embodiment.
It should be noted here that the modules described above are the same as the examples and application scenarios implemented by the corresponding steps, but are not limited to the disclosure of the above embodiments. It should be noted that the modules described above as a part of the apparatus may operate in a hardware environment as shown in fig. 1, and may be implemented by software or hardware.
As an alternative embodiment, the task execution device may further include: a second setting unit configured to set an execution state of the target task to a state in which execution is permitted, in a case where the task switch instruction indicates permission of execution of the target task; and the second execution unit is used for executing the target task when the condition that the trigger condition of the target task is met and the execution state of the target task is the state that the execution is allowed.
As an alternative embodiment, the task execution device may further include: the configuration unit is used for configuring execution states for the tasks in the target service before acquiring the task switch instruction, wherein one execution state corresponds to one or more tasks.
As an alternative embodiment, the task execution device may further include: the analysis unit is used for analyzing the task switch instruction after the task switch instruction is acquired to obtain the description information of the target task and the execution state of the target task; and the establishing unit is used for establishing a mapping relation between the description information of the target task and the execution state of the target task.
Optionally, the establishing unit may include: the construction module is used for constructing the description information of the target task into a character array; the calculation module is used for carrying out hash calculation on the character array to obtain a hash value; and the establishing module is used for establishing a mapping relation between the hash value and the execution state of the target task.
As an alternative embodiment, the first executing unit 66 may include: the first acquisition module is used for acquiring the description information of the target task under the condition that the trigger condition of the target task is met; the second acquisition module is used for acquiring the execution state of the target task which has a mapping relation with the description information of the target task; and the execution module is used for skipping the execution of the target task under the condition that the execution state of the target task is a state which is not allowed to be executed.
Optionally, the second obtaining module may include: the construction submodule is used for constructing the description information of the target task into a character array; the calculation submodule is used for carrying out hash calculation on the character array to obtain a hash value; and the obtaining submodule is used for obtaining the execution state of the target task with the mapping relation with the hash value.
As an alternative embodiment, the task execution device may further include: and the packing unit is used for packing the task switch instruction according to a preset protocol before the task switch instruction is acquired to obtain the packed task switch instruction, and correspondingly, the acquisition unit is used for acquiring the packed task switch instruction.
Through the module, the technical problem that the execution states of part of tasks cannot be flexibly adjusted in the external service period of the server in the related art can be solved, and the technical effect of improving the adjustment efficiency of the execution states of the tasks is achieved.
According to another aspect of the embodiment of the present invention, there is also provided an electronic device for implementing the task execution method.
Fig. 7 is a block diagram of an electronic device according to an embodiment of the present invention, and as shown in fig. 7, the electronic device may include: one or more processors 201 (only one is shown in the figure), a memory 203, wherein the memory 203 may store a computer program, and the processor 201 may be configured to execute the computer program to perform the task execution method according to the embodiment of the present invention.
The memory 203 may be used to store computer programs and modules, such as program instructions/modules corresponding to the task execution method and apparatus in the embodiments of the present invention, and the processor 201 executes various functional applications and data processing by running the computer programs and modules stored in the memory 203, that is, implements the task execution method described above. The memory 203 may include high speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 203 may further include memory located remotely from the processor 201, which may be connected to the terminal over a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
Optionally, as shown in fig. 7, the electronic device may further include: a transmission device 205 and an input-output device 207. Wherein the transmission means 205 is used for receiving or transmitting data via a network. Examples of the network may include a wired network and a wireless network. In one example, the transmission device 205 includes a Network adapter (NIC) that can be connected to a router via a Network cable and other Network devices to communicate with the internet or a local area Network. In one example, the transmission device 205 is a Radio Frequency (RF) module, which is used for communicating with the internet in a wireless manner.
It can be understood by those skilled in the art that the structure shown in fig. 7 is only an illustration, and the electronic device may be a terminal device such as a smart phone (e.g., an Android phone, an iOS phone, etc.), a tablet computer, a palm computer, and a Mobile Internet Device (MID), a PAD, etc. Fig. 7 is a diagram illustrating a structure of the electronic device. For example, the electronic device may also include more or fewer components (e.g., network interfaces, display devices, etc.) than shown in FIG. 7, or have a different configuration than shown in FIG. 7.
Alternatively, in this embodiment, the memory 203 may be used to store a computer program.
Optionally, in this embodiment, the processor may be configured to execute a computer program to perform the following steps: acquiring a task switch instruction, wherein the task switch instruction is used for indicating whether to allow a target task in a target service to be executed; setting the execution state of the target task to a state in which execution is not allowed in the case where the task switch instruction indicates that execution of the target task is not allowed; and skipping the execution of the target task when the trigger condition of the target task is satisfied and the execution state of the target task is a state in which the execution is not allowed.
The processor 201 is further configured to perform the following steps: setting the execution state of the target task to be a state allowing execution in the case that the task switch instruction indicates permission of execution of the target task; and executing the target task when the trigger condition of the target task is met and the execution state of the target task is a state allowing execution.
The processor 201 is further configured to perform the following steps: before a task switch instruction is acquired, executing states are configured for tasks in a target service, wherein one executing state corresponds to one or more tasks.
The processor 201 is further configured to perform the following steps: after the task switching instruction is obtained, analyzing the task switching instruction to obtain the description information of the target task and the execution state of the target task; and establishing a mapping relation between the description information of the target task and the execution state of the target task.
The processor 201 is further configured to perform the following steps: constructing description information of a target task into a character array; performing hash calculation on the character array to obtain a hash value; and establishing a mapping relation between the hash value and the execution state of the target task.
The processor 201 is further configured to perform the following steps: under the condition that the trigger condition of the target task is met, acquiring description information of the target task; acquiring an execution state of a target task having a mapping relation with description information of the target task; when the execution state of the target task is a state in which execution is not permitted, execution of the target task is skipped.
The processor 201 is further configured to perform the following steps: constructing description information of a target task into a character array; performing hash calculation on the character array to obtain a hash value; and acquiring the execution state of the target task having the mapping relation with the hash value.
The processor 201 is further configured to perform the following steps: before the task switching instruction is obtained, packaging the task switching instruction according to a preset protocol to obtain a packaged task switching instruction; and acquiring a packed task switch instruction.
Optionally, the specific examples in this embodiment may refer to the examples described in the above embodiments, and this embodiment is not described herein again.
The embodiment of the invention provides a task execution scheme. The method comprises the steps of obtaining a task switch instruction, setting the execution state of a target task to be a state which is not allowed to be executed under the condition that the task switch instruction indicates that the target task is not allowed to be executed, skipping execution of the target task under the condition that the trigger condition of the target task is met and the execution state of the target task is the state which is not allowed to be executed, achieving the purpose of flexibly adjusting the execution state of the target task, further solving the technical problem that the execution state of part of tasks cannot be flexibly adjusted during the period that a server serves the outside in the related art, and achieving the technical effect of improving the adjustment efficiency of the task execution state.
According to still another aspect of an embodiment of the present invention, there is also provided a storage medium. The storage medium has stored therein a computer program, wherein the computer program is arranged to perform the steps of the task execution method in the above embodiments when run.
Alternatively, in this embodiment, the storage medium may be located on at least one of the plurality of network devices in the network shown in the above-described embodiment.
Alternatively, in the present embodiment, the storage medium is configured to store a computer program for executing the steps of:
s1, acquiring a task switch instruction, wherein the task switch instruction is used for indicating whether to allow the target task in the target service to be executed;
s2, setting the execution state of the target task to be a state of not allowing the execution under the condition that the task switch instruction indicates not allowing the execution of the target task;
s3, when it is detected that the trigger condition of the target task is satisfied and the execution state of the target task is a state in which execution is not permitted, execution of the target task is skipped.
Optionally, the storage medium is further arranged to store a computer program for performing the steps of: setting the execution state of the target task to be a state allowing execution in the case that the task switch instruction indicates permission of execution of the target task; and executing the target task when the trigger condition of the target task is met and the execution state of the target task is a state allowing execution.
Optionally, the storage medium is further arranged to store a computer program for performing the steps of: before a task switch instruction is acquired, executing states are configured for tasks in a target service, wherein one executing state corresponds to one or more tasks.
Optionally, the storage medium is further arranged to store a computer program for performing the steps of: after the task switching instruction is obtained, analyzing the task switching instruction to obtain the description information of the target task and the execution state of the target task; and establishing a mapping relation between the description information of the target task and the execution state of the target task.
Optionally, the storage medium is further arranged to store a computer program for performing the steps of: constructing description information of a target task into a character array; performing hash calculation on the character array to obtain a hash value; and establishing a mapping relation between the hash value and the execution state of the target task.
Optionally, the storage medium is further arranged to store a computer program for performing the steps of: under the condition that the trigger condition of the target task is met, acquiring description information of the target task; acquiring an execution state of a target task having a mapping relation with description information of the target task; when the execution state of the target task is a state in which execution is not permitted, execution of the target task is skipped.
Optionally, the storage medium is further arranged to store a computer program for performing the steps of: constructing description information of a target task into a character array; performing hash calculation on the character array to obtain a hash value; and acquiring the execution state of the target task having the mapping relation with the hash value.
Optionally, the storage medium is further arranged to store a computer program for performing the steps of: before the task switching instruction is obtained, packaging the task switching instruction according to a preset protocol to obtain a packaged task switching instruction; and acquiring a packed task switch instruction.
Optionally, the specific examples in this embodiment may refer to the examples described in the above embodiments, and this embodiment is not described herein again.
Alternatively, in this embodiment, a person skilled in the art may understand that all or part of the steps in the method of the foregoing embodiment may be implemented by a program instructing hardware related to the terminal device, where the program may be stored in a computer-readable storage medium, and the storage medium may include: flash disks, Read-Only memories (ROMs), Random Access Memories (RAMs), magnetic or optical disks, and the like.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
The integrated unit in the above embodiments, if implemented in the form of a software functional unit and sold or used as a separate product, may be stored in the above computer-readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for causing one or more computer devices (which may be personal computers, servers, network devices, etc.) to execute all or part of the steps of the method according to the embodiments of the present invention.
In the above embodiments of the present invention, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
In the several embodiments provided in the present application, it should be understood that the disclosed client may be implemented in other manners. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units is only one type of division of logical functions, and there may be other divisions when actually implemented, for example, a plurality of units or components may be combined or may be integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, units or modules, and may be in an electrical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The foregoing is only a preferred embodiment of the present invention, and it should be noted that, for those skilled in the art, various modifications and decorations can be made without departing from the principle of the present invention, and these modifications and decorations should also be regarded as the protection scope of the present invention.

Claims (15)

1. A method of task execution, comprising:
acquiring a task switch instruction, wherein the task switch instruction is used for indicating whether to allow a target task in a target service to be executed;
in the case that the task switch instruction indicates that the target task is not allowed to be executed, changing the execution state of the target task from an initial execution state in which the execution is allowed to a state in which the execution is not allowed;
and skipping the execution of the target task when the trigger condition of the target task is met and the execution state of the target task is a state not allowing the execution.
2. The method of claim 1, wherein in the event that the task switch instruction indicates permission to perform the target task, the method further comprises:
setting the execution state of the target task to be a state allowing execution;
and executing the target task when the trigger condition of the target task is met and the execution state of the target task is a state allowing execution.
3. The method of claim 1, wherein prior to said obtaining a task switch command, the method further comprises:
and configuring execution states for the tasks in the target service, wherein one execution state corresponds to one or more tasks.
4. The method of claim 1, wherein after the obtaining a task switch command, the method further comprises:
analyzing the task switch instruction to obtain the description information of the target task and the execution state of the target task;
and establishing a mapping relation between the description information of the target task and the execution state of the target task.
5. The method of claim 4, wherein the establishing a mapping relationship between the description information of the target task and the execution state of the target task comprises:
constructing the description information of the target task into a character array;
performing hash calculation on the character array to obtain a hash value;
and establishing a mapping relation between the hash value and the execution state of the target task.
6. The method according to claim 1, wherein the skipping execution of the target task in the case that the trigger condition of the target task is satisfied and the execution state of the target task is a state in which execution is not allowed comprises:
under the condition that the trigger condition of the target task is met, acquiring description information of the target task;
acquiring an execution state of the target task having a mapping relation with the description information of the target task;
and when the execution state of the target task is a state that execution is not allowed, skipping execution of the target task.
7. The method according to claim 6, wherein the obtaining of the execution state of the target task having a mapping relation with the description information of the target task comprises:
constructing the description information of the target task into a character array;
performing hash calculation on the character array to obtain a hash value;
and acquiring the execution state of the target task having a mapping relation with the hash value.
8. The method according to any one of claims 1 to 7,
before the obtaining of the task switch instruction, the method further comprises: packaging the task switching instruction according to a preset protocol to obtain a packaged task switching instruction;
the acquiring of the task switch instruction comprises: and acquiring the packed task switch instruction.
9. A task execution apparatus, comprising:
the system comprises an acquisition unit, a processing unit and a processing unit, wherein the acquisition unit is used for acquiring a task switch instruction, and the task switch instruction is used for indicating whether to allow a target task in a target service to be executed or not;
a first setting unit configured to change an execution state of the target task from an initial execution state in which execution is permitted to a state in which execution is not permitted, in a case where the task switch instruction indicates that execution of the target task is not permitted;
and the first execution unit is used for skipping the execution of the target task when the trigger condition of the target task is met and the execution state of the target task is a state which is not allowed to be executed.
10. The apparatus of claim 9, further comprising:
a second setting unit configured to set an execution state of the target task to a state in which execution is permitted, in a case where the task switch instruction indicates that execution of the target task is permitted;
and the second execution unit is used for executing the target task when the condition that the trigger condition of the target task is met and the execution state of the target task is a state allowing execution is detected.
11. The apparatus of claim 9, further comprising:
and the configuration unit is used for configuring execution states for the tasks in the target service before the task switch instruction is acquired, wherein one execution state corresponds to one or more tasks.
12. The apparatus of claim 9, further comprising:
the analysis unit is used for analyzing the task switch instruction after the task switch instruction is obtained to obtain the description information of the target task and the execution state of the target task;
and the establishing unit is used for establishing a mapping relation between the description information of the target task and the execution state of the target task.
13. The apparatus of claim 9, wherein the first execution unit comprises:
the first acquisition module is used for acquiring the description information of the target task under the condition that the trigger condition of the target task is met;
the second acquisition module is used for acquiring the execution state of the target task which has a mapping relation with the description information of the target task;
and the execution module is used for skipping the execution of the target task under the condition that the execution state of the target task is a state which is not allowed to be executed.
14. A storage medium, in which a computer program is stored, wherein the computer program is arranged to execute the task execution method according to any one of claims 1 to 8 when executed.
15. An electronic device comprising a memory and a processor, wherein the memory has stored therein a computer program, and wherein the processor is configured to execute the computer program to perform the task execution method of any of claims 1 to 8.
CN201810064392.6A 2018-01-23 2018-01-23 Task execution method and device, storage medium and electronic device Active CN108459889B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810064392.6A CN108459889B (en) 2018-01-23 2018-01-23 Task execution method and device, storage medium and electronic device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810064392.6A CN108459889B (en) 2018-01-23 2018-01-23 Task execution method and device, storage medium and electronic device

Publications (2)

Publication Number Publication Date
CN108459889A CN108459889A (en) 2018-08-28
CN108459889B true CN108459889B (en) 2021-06-08

Family

ID=63238673

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810064392.6A Active CN108459889B (en) 2018-01-23 2018-01-23 Task execution method and device, storage medium and electronic device

Country Status (1)

Country Link
CN (1) CN108459889B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110262888B (en) * 2019-06-26 2020-11-20 京东数字科技控股有限公司 Task scheduling method and device and method and device for computing node to execute task
CN112388625B (en) * 2019-08-15 2022-05-24 纳恩博(北京)科技有限公司 Task issuing method and device and task executing method and device
CN113282341B (en) * 2020-02-20 2023-12-22 浙江宇视科技有限公司 Service control method, device, equipment and medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102244659A (en) * 2011-06-30 2011-11-16 成都市华为赛门铁克科技有限公司 Execution method and apparatus of security policy script and security policy system
CN105426257A (en) * 2015-12-25 2016-03-23 北京奇虎科技有限公司 Method and device for executing task
CN105511958A (en) * 2014-10-11 2016-04-20 阿里巴巴集团控股有限公司 Method and device for task scheduling
JP2017529605A (en) * 2014-09-02 2017-10-05 アビニシオ テクノロジー エルエルシー Managing task invocation

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102244659A (en) * 2011-06-30 2011-11-16 成都市华为赛门铁克科技有限公司 Execution method and apparatus of security policy script and security policy system
JP2017529605A (en) * 2014-09-02 2017-10-05 アビニシオ テクノロジー エルエルシー Managing task invocation
CN105511958A (en) * 2014-10-11 2016-04-20 阿里巴巴集团控股有限公司 Method and device for task scheduling
CN105426257A (en) * 2015-12-25 2016-03-23 北京奇虎科技有限公司 Method and device for executing task

Also Published As

Publication number Publication date
CN108459889A (en) 2018-08-28

Similar Documents

Publication Publication Date Title
CN105656688B (en) Condition control method and device
CN108459889B (en) Task execution method and device, storage medium and electronic device
CN106161100B (en) A kind of internet of things equipment configuration method and internet-of-things terminal
CN107864065B (en) Non-buried point data acquisition method, system and computer readable storage medium
CN104021141B (en) Method, device and system for data processing and cloud service
CN108256118B (en) Data processing method, device, system, computing equipment and storage medium
CN111181943A (en) Service interaction method and device based on service middlebox, computer equipment and computer storage medium
CN111427664A (en) Container-based protocol analysis method, device, system and storage medium
CN106875651B (en) Network structure, software implementation long distance wireless head controller and long distance wireless head
CN112528296B (en) Vulnerability detection method and device, storage medium and electronic equipment
CN108733496A (en) Event-handling method and device
CN108667639A (en) A kind of method for managing resource under privately owned cloud environment and management server
CN111045893A (en) Method, device and system for executing monitoring task, storage medium and electronic device
CN112596768A (en) Device updating method and device, storage medium and electronic device
CN107526584B (en) Data access method and device
CN108882278A (en) Data link monitoring method, unit and computer readable storage medium
CN111130828B (en) Intelligent network distribution method and device and terminal equipment
CN109845191A (en) Polymorphic virtualization network function
CN116257427A (en) Heterogeneous test method, heterogeneous test system, heterogeneous test equipment and heterogeneous test storage medium for federal learning task
CN109343944A (en) Data processing method, device, terminal and the storage medium of eSIM card
CN111897634A (en) Operator operation method and device, storage medium and electronic device
CN113434541A (en) Method and device for sending query result, storage medium and electronic device
KR101665008B1 (en) Apparatus and method for analyzing data
CN105162641A (en) Monitoring method and device for cloud desktop
CN112751706A (en) Target data transmission method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant