Restarting Application Engine Programs 重新启动应用程序引擎程序

Restarting Application Engine Programs

重新启动应用程序引擎程序

A key feature of Application Engine is its built-in checkpoint and restart capabilities. If a program step terminates abnormally or fails, you can restart the request from the last successful checkpoint or from the step immediately preceding the step that failed. You restart the program from the process request page.

Application Engine的一个关键特性是其内置的检查点和重新启动功能。如果程序步骤异常终止或失败,则可以从最后一个成功的检查点或从紧接失败步骤之前的步骤重新启动请求。从进程请求页面重新启动程序。

This section provides an overview of restart and discusses how to:

本节概述重新启动,并讨论如何:

  • Determine when to use restart.
  • 确定何时使用重新启动。
  • Control abnormal terminations.
  • 控制异常终止。
  • Restart Application Engine programs.
  • 重新启动应用程序引擎程序。
  • Start Application Engine programs from the beginning.
  • 从头开始应用程序引擎程序。
  • Enable and disable restart.
  • 启用和禁用重新启动。
Understanding Restart
理解重新启动

Application Engine programs save to the database (perform a commit) only when an entire program successfully completes. You must set individual commits where appropriate.

只有当整个程序成功完成时,应用程序引擎程序才会保存到数据库(执行提交)。您必须在适当的地方设置单独的提交。

At the section level, you can set a commit after each step in a section. At the step level, you can require or defer commits for individual steps, or you can increase the commit frequency within a step to N iterations of a looping action, such as a Do Select of Do While, within a step.

在节级别,您可以在节中的每个步骤之后设置提交。在步骤级别,您可以要求或推迟各个步骤的提交,也可以将步骤中的提交频率增加到循环操作的N次迭代,例如Do Select of Do而,在一步之内。

The commit level that you select affects how restart works in a program. Each time Application Engine issues a commit with restart enabled, it records the current state of the program. The recording of the current state that Application Engine performs is referred to as a checkpoint.

您选择的提交级别会影响重新启动在程序中的工作方式。每次Application Engine发出启用重新启动的提交时,它都会记录程序的当前状态。应用程序引擎执行的当前状态的记录称为检查点。

Using the restart feature enables you to perform commits more often in a program. Restart reduces the overall effect on other users and processes while the background program is running because it reduces the number of rows that are locked by the program. Fewer rows allows multiple instances of the program to run concurrently (parallel processing), which may be useful for high-volume solutions.

使用restart特性使您能够在程序中更频繁地执行提交。重新启动减少了后台程序运行时对其他用户和进程的总体影响,因为它减少了程序锁定的行数。更少的行允许程序的多个实例并发运行(并行处理),这可能对大容量解决方案很有用。

With restart, if a failure occurs at any point in the process, the user can restart the program and expect the program to behave as follows:

用重新启动,如果在过程中的任何一点发生故障,用户可以重新启动程序,并期望程序的行为如下:

  • Ignore the steps that have already completed up to the last successful commit.
  • 忽略上一次成功提交之前已经完成的步骤。
  • Begin processing at the next step after the last successful commit.
  • 在最后一次成功提交后,开始下一步的处理。

The ability for Application Engine to remember completed steps depends on a record called AERUNCONTROL, which is keyed by process instance.

应用程序引擎记忆已完成步骤的能力取决于名为AERUNCONTROL的记录,该记录由流程实例作为键。

When a program runs, each time Application Engine issues a commit it also saves all of the information required for a program restart in the AERUNCONTROL record.

当程序运行时,每次应用程序引擎发出提交时,它还会将程序重新启动所需的所有信息保存在AERUNCONTROL记录中。

Determining When to Use Restart
确定何时使用重新启动

Usually, you want to develop programs to take advantage of Application Engine restart capabilities. Programs that are good candidates for restart do a lot of preparation work initially, such as joining tables and loading data into temporary work tables. Also, you should consider restart capabilities for programs that might put data in an unstable state if they terminate abnormally during a run. As a general rule, restart is essential for programs that primarily do set-based processing.

通常,您希望开发程序以利用应用程序引擎重新启动功能。适合重新启动的程序最初会做大量的准备工作,例如连接表和将数据加载到临时工作表中。此外,如果程序在运行过程中异常终止,则可能会使数据处于不稳定状态,您应该考虑这些程序的重新启动功能。作为一般规则,对于主要执行基于集合的处理的程序,重新启动是必不可少的。

However, you may want to disable restart if your program has one the following characteristics:

但是,如果您的程序具有以下特征之一,您可能需要禁用重新启动:

  • It is mainly row-by-row processing.
  • 主要是逐行处理。
  • The overhead involved with Application Engine performing a checkpoint during the program run is not desirable.
  • 应用程序引擎在程序运行期间执行检查点所涉及的开销是不可取的。
  • The program commits after N iterations of a looping construct within a step, and the Select statement driving the loop is composed in such a way that if the program terminated and then started again it would ignore transactions that were already processed in the previous program run. In a sense, the program processes the restart internally: Application Engine treats each start of a program as a fresh start, instead of restarting a previous instance.
  • ·程序在一个步骤内的循环构造N次迭代后提交,驱动循环的Select语句以这样一种方式组成:如果程序终止,然后再次启动,它将忽略在前一个程序运行中已经处理过的事务。从某种意义上说,程序在内部处理重新启动:应用程序引擎将程序的每次启动视为全新启动,而不是重新启动以前的实例。

When developing for restart, consider the consequences if a program fails and you cannot restart the program. Given the commit structure that you defined for your Application Engine program, would your data remain in an usual state if a failure were to occur after any of the commits? Would it be easy to recover from such a case?

在进行重新启动开发时,请考虑程序失败而无法重新启动程序的后果。给定您为应用程序引擎程序定义的提交结构,如果在任何提交之后发生故障,您的数据将保持通常的状态吗?这样的情况下,恢复过来会容易吗?

Using Restart at the Program Level

在程序级使用重新启动

Application Engine automatically updates all state records. When an Application Engine program starts, it inserts a row in the state record for the assigned process instance. Then the system updates the state record whenever the program performs a commit to store changed values into the database. Finally, the system deletes the state record row upon successful completion of the application.

应用程序引擎会自动更新所有状态记录。当应用程序引擎程序启动时,它会在分配的流程实例的状态记录中插入一行。然后,每当程序执行提交以将更改的值存储到数据库中时,系统就会更新状态记录。最后,系统在成功完成应用程序时删除状态记录行。

However, if the state record the program uses is a work record, you cannot make any database updates to the record. Consequently, if you restart the program, you might get unexpected results because the memory was lost when the program terminated. In fact, the system re-initializes any state records that are work records at each commit in order to ensure consistent behavior during a normal run and a restarted run. Therefore, you may need to make at least one of your state records a SQL table to contain values that must be retained across commits or in case of termination.

但是,如果程序使用的状态记录是工作记录,则不能对该记录进行任何数据库更新。因此,如果重新启动程序,可能会得到意外的结果,因为程序终止时丢失了内存。事实上,系统会在每次提交时重新初始化作为工作记录的任何状态记录,以确保在正常运行和重新启动运行期间行为的一致性。因此,您可能需要使至少一个状态记录成为SQL表,以包含在提交之间或终止时必须保留的值。

Finally, the other consideration for programming for restart at the program level is to check both the Application Engine Program Properties dialog box and PeopleSoft Configuration Manager to make sure the Disable Restart check box is not selected.

最后,在程序级别上为重新启动而编程的另一个考虑是同时检查-Application Engine Program Properties对话框和PeopleSoft Configuration Manager,以确保禁用重新启动复选框没有被选中。

Using Restart at the Section Level

在节级别使用重新启动

The section level property associated with restart is section type, which has the options Prepare Only and Critical Updates.

与重新启动相关联的节级别属性是节类型,它具有选项“仅准备”和“关键更新”。

If a section only prepares data, as in selecting it, populating temporary tables, or updating temporary tables, then set the section type to Prepare Only. However, if the section updates permanent application tables in the database, then set the option to Critical Updates.

如果节只准备数据,如选择它、填充临时表或更新临时表,则将节类型设置为Prepare Only。但是,如果该部分更新数据库中的永久应用程序表,则将该选项设置为Critical Updates。

During runtime, when the system arrives at the first section set to Critical Updates, it sets the

AE_CRITICAL_PHASE value in the AERUNCONTROL record to Y. Once set, the value of AE_CRITICAL_PHASE remains Y until the program completes successfully. When the program completes, the corresponding row in AERUNCONTROL is deleted. Therefore, a Prepare Only section following the Critical Updates section will not reset the AE_CRITICAL_PHASE value to N.

在运行时,当系统到达设置为Critical Updates的第一个部分时,它将AERUNCONTROL记录中的AE_CRITICAL_PHASE值设置为一旦设置好,AE_临界值将保持为Y,直到程序成功完成为止。程序完成后,AERUNCONTROL中相应的行将被删除。因此,在关键更新部分之后的仅准备部分不会将AE_CRITICAL_PHASE值重置为N。

If your program terminates, the user can check the AE_CRITICAL_PHASE value. If it is Y, then the user knows that the section that failed is critical and that the program should be restarted to ensure data integrity. If AE_CRITICAL_PHASE is N, restarting may not be necessary; however, as a general rule you should restart even if AE_CRITICAL_PHASE is set to N.

如果程序终止,用户可以检查AE_CRICAL_PHASE值。如果是Y,那么用户知道失败的部分是关键的,应该重新启动程序以确保数据的完整性。如果AE_CRITICAL_PHASE为N,则可能不需要重新启动;但是,作为一般规则,即使AE_CRITICAL_PHASE设置为N,您也应该重新启动。

Using Restart at the Step Level

在步骤级别使用重新启动

In the Where clause of a Do Select action in your program, you should include conditions that reduce the answer set returned from the Select statement.

在程序中的Do Select操作的Where子句中,应包含减少从Select语句返回的答案集的条件。

For example:

举个例子:

SELECT RECNAME, FIELDNAME

   FROM PS_AE_RECFIELD

   ORDER BY RECNAME, FIELDNAME

If you ran this Select statement as part of a Do Select action with Restartable selected as the Do Select type, the system might process some of the rows twice after a restart. Also, if you specified Reselect, the program could execute in an infinite loop because no code exists to reduce the answer set. However, if you modified the Select statement as follows, you could make it Restartable:

如果将此Select语句作为Do Select操作的一部分运行,并将Restartable选作Do Select类型,则系统可能会在重新启动后两次处理某些行。此外,如果指定了“重新选择”,则程序可以在无限循环中执行,因为不存在减少答案集的代码。但是,如果您按以下方式修改了Select语句,则可以将其重新启动:

SELECT RECNAME, FIELDNAME

FROM PS_AE_RECFIELD

WHERE RECNAME > %Bind(RECNAME)

OR (RECNAME = %Bind(RECNAME) AND FIELDNAME > %Bind(FIELDNAME))

ORDER BY RECNAME, FIELDNAME

You can convert a Do Select action that was coded for Restartable to Select/Fetch, but the opposite is not true.

您可以将为Restartable编码的Do Select操作转换为Select/Fetch,但相反的情况并非如此。

The previous example shows the use of a key column to reduce the answer set. A key column can be convenient if your record has only one or two key fields; however, if your record has three or four keys, your SQL would become overly complex.

前面的示例显示了使用键列来减少答案集。如果您的记录只有一个或两个键字段,则键列可能很方便;但是,如果您的记录有三个或四个键,则SQL将变得过于复杂。

Instead of matching key fields, you could add a switch to the selected table and then have the processing of the called section modify the switch as it processes the row. In this example, your Select statement might look like this:

不需要匹配键字段,您可以向所选表添加一个开关,然后让被调用部分的处理在处理该行时修改该开关。在本例中,您的Select语句可能如下所示:

SELECT COLUMN1, COLUMN2, . . .

   FROM PS_TABLE1    WHERE PROCESSING_SWITCH=’N’. . .

Controlling Abnormal Terminations
控制异常终止

A controlled abnormal termination (sometimes called an abend) means that Application Engine exits gracefully because of a calculated error condition. Examples of controlled abends are:

受控异常终止(有时称为异常终止)意味着应用程序引擎由于计算出的错误条件而正常退出。受控偏差的例子有:

  • SQL errors while On Error is set to Abort.
  • 当“出错”设置为“中止”时出现SQL错误。
  • A PeopleCode return value when On Return is set to Abort.
  • 当“返回时”设置为“中止”时,返回一个PeopleCode返回值。
  • A SQL statement that affects no rows when On No Rows is set to Abort.
  • 当“无行”设置为“中止”时,不影响任何行的SQL语句。

In these situations (when Application Engine is in control), the Run Status field in Process Monitor reads Error.

在这些情况下(当应用程序引擎处于受控状态时),进程监视器中的运行状态字段读取错误。

An uncontrolled termination occurs when a memory violation occurs or a user terminates a process. In these cases, the Run Status field in Process Monitor reads Processing.

当发生内存冲突或用户终止进程时,会发生不受控制的终止。在这些情况下,Process Monitor中的Run Status字段读取Processing。

Restarting Application Engine Programs
重新启动应用程序引擎程序

You can restart an Application Engine program in one of these ways:

您可以通过以下方式之一重新启动应用程序引擎程序:

  • From the command line.
  • 从命令行。
  • From a process request page.
  • 来自一个进程请求页面。

Note: The following procedures for restarting a failed Application Engine program assume that you have rectified the error that caused the program to fail in the first place. For instance, suppose the name of a referenced table has changed. Regardless of how many times you restart the program, it will continue to fail until you modify all references to the old table name.

附注:以下重新启动失败的应用程序引擎程序的过程假定您已经纠正了导致程序失败的错误。例如,假设引用的表的名称已更改。无论重新启动程序多少次,它都将继续失败,直到修改对旧表名的所有引用。

Restarting from the Command Line

从命令行重新启动

Normally, only developers and system administrators use the command line for restarting Application Engine programs. Users, in most cases, should not be expected to use this method.

通常,只有开发人员和系统管理员使用命令行重新启动应用程序引擎程序。在大多数情况下,不应该期望用户使用此方法。

You can use the command line option to restart programs that run on the client or the server. Application Engine references only the process instance of the failed process. Therefore, if you run a process on the client and it fails, you can restart it from the server using the server command line. Likewise, if you run a process from the server and it fails, you can restart it from the client using the command line.

可以使用命令行选项重新启动在客户端或服务器上运行的程序。应用程序引擎仅引用失败流程的流程实例。因此,如果您在客户机上运行一个进程,但它失败了,您可以使用服务器命令行从服务器重新启动它。同样,如果您从服务器运行一个进程,但它失败了,您可以使用命令行从客户端重新启动它。

To restart an Application Engine program from the command line:

要从命令行重新启动应用程序引擎程序,请执行以下操作:

  1. Collect the command line values associated with the failed program.

收集与失败程序相关联的命令行值。

These values include database type, database name, user ID and password, run control ID, program name, and process instance. You can find these variables in the Process Details dialog box, the corresponding state record, or the Application Engine Run Control table. Where the values reside depends on how you invoked the program. For instance, if you invoked the program using the command line or from outside of PeopleSoft Process Scheduler, then you cannot view details associated with the program run in the Process Details dialog box.

这些值包括数据库类型、数据库名称、用户ID和密码、运行控制ID、程序名和流程实例。您可以在“进程详细信息”对话框、相应的状态记录或“应用程序引擎运行控制表”中找到这些变量。值驻留的位置取决于您调用程序的方式。例如,如果您使用-命令行或从PeopleSoft进程调度程序的外部调用程序,那么您无法查看详细信息-与在进程详细信息对话框中运行的程序相关。

  1. Enter the following command line syntax at the command prompt, substituting the values from the previous step:

在命令提示符下输入以下命令行语法,替换上一步中的值:

PSAE.EXE −CT DB_TYPE -CD DB_NAME -CO OPRID -CP PASSWORD -R RUN_CONTROL -AI PRO

GRAM_NAME -I PROCESS_INSTANCE

Note: Some database platforms also require that you include a server name in the argument list.

注意:某些数据库平台还要求在参数列表中包含服务器名称。

Restarting from a Process Request Page

从进程请求页面重新启动

The only programs you can restart from a process request page are those that run on the server.

可以从进程请求页面重新启动的程序只有那些在服务器上运行的程序。

To restart an Application Engine program from a process request page:

要从进程请求页面重新启动应用程序引擎程序,请执行以下操作:

  1. Open PeopleSoft Process Scheduler by selecting PeopleTools > Process Scheduler > System Process Requests.

通过选择PeopleTools>打开PeopleSoft进程调度器进程调度程序>系统进程请求。

  1. Locate the run control ID number of the program to restart.

找到要重新启动的程序的运行控制ID号。

  1. To display the details of the failed process, click the Process Detail link.

要显示失败进程的详细信息,请单击“进程详细信息”链接。

  1. On the Process Request Details page, select Restart Request and click OK.

在“进程请求详细信息”页上,选择“重新启动请求”,然后单击“确定”。

Bad Restart Errors

错误的重新启动错误

If you attempt to restart a process that completed successfully according to Application Engine, you will receive a bad restart message. You will also get this message if your Application Engine application is defined with restart disabled.

如果尝试重新启动已根据应用程序引擎成功完成的进程,将收到错误的重新启动消息。如果您的应用程序引擎应用程序定义为禁用重新启动,您也会收到此消息。

Starting Application Engine Programs from the Beginning
从头开始启动应用程序引擎程序

When an Application Engine program ends abnormally, you may have to decide whether you should restart the process or start it from the beginning. As your Application Engine program ran at least part way through, starting over may leave your data in an unknown state. Also, application logic might need to be undone, depending on the stage of the program when it failed, what data the program had committed, and so on.

当应用程序引擎程序异常结束时,您可能必须决定是重新启动该进程还是从头开始。由于您的应用程序引擎程序至少运行了一部分方式通过,重新开始可能会让您的数据处于未知状态。此外,应用程序逻辑可能需要撤消,这取决于程序失败时所处的阶段、程序已提交的数据等

However, if restart is enabled and you attempt to start a new process that matches the run control ID and user ID for another process, then you receive a suspend error. Because the process instance for these two processes is different, the new request fails. This event usually occurs when a user tries to run the program again after receiving an error on the previous attempt.

但是,如果启用了重新启动,并且您尝试启动一个与另一个进程的运行控制ID和用户ID匹配的新进程,则会收到一个挂起错误。因为这两个进程的进程实例不同,所以新请求失败。此事件通常发生在用户在前一次尝试中收到错误后再次尝试运行该程序时。

To start the program over from the beginning, you can use SQL to delete the row that corresponds to the failed program from the Application Engine run control table and your state record.

若要从头开始重新启动程序,可以使用SQL从Application Engine运行控制表和状态记录中删除与失败程序对应的行。

To restart an Application Engine program from the beginning:

要从头重新启动应用程序引擎程序,请执行以下操作:

  1. Open your native SQL editor and manually delete the row in PS_AERUNCONTROL that corresponds to the program you want to start from the beginning.

打开本机SQL编辑器,手动删除PS_AERUNCONTROL中与要从头启动的程序对应的行。

Use the following SQL to accomplish this step:

使用以下SQL来完成此步骤:

DELETE FROM PS_AERUNCONTROL

WHERE OPRID=OPRID

AND RUN_CNTL_ID=Run_Control_ID

  1. Delete from your state record the row that corresponds to the failed program run.

从状态记录中删除与失败的程序运行相对应的行。

Use the following SQL to accomplish this step:

使用以下SQL来完成此步骤:

DELETE FROM PS_MY_AET

WHERE PROCESS_INSTANCE=Process_Instance

Note: To restart the program, you can also select Restart Request from the Process Request Details dialog box.

附注:要重新启动程序,还可以从“进程请求详细信息”对话框中选择“重新启动请求”。

Enabling and Disabling Restart
启用和禁用重新启动

To disable restart, use any of these methods:

若要禁用重新启动,请使用以下任一方法:

  • Select the Disable Restart check box in the Application Engine Program Properties dialog box.
  • 在应用程序引擎程序属性对话框中选中禁用重新启动复选框。

To access program properties, select File, Definition properties and select the Advanced tab.

要访问程序属性,请选择“文件”、“定义属性”,然后选择“高级”选项卡。

  • Select the Disable Restart check box in the Configuration Manager profile.
  • 选中配置管理器配置文件中的禁用重新启动复选框。

To access the profile, start Configuration Manager, select the Profile tab, and click Edit. Then select the Process Scheduler tab.

要访问配置文件,请启动配置管理器,选择配置文件选项卡,然后单击编辑。然后选择进程调度器选项卡。

  • Include the -DR Y option in the command line of PSAE.EXE.
  • 在PS AE.EXE的命令行中包含-DR Y选项。

If you disabled restart in any of these three places, restart is disabled.

如果您在这三个位置中的任意一个禁用了重新启动,则将禁用重新启动。

If you want the program to restart in a production environment while still keeping a restart condition from getting in the way during development and testing, you can deselect the Disable Restart check box in the Application Engine program properties. Then, during development, you can select theDisable Restart check box in Configuration Manager or invoke your program from the command line with the -DR Y option without having to re-configure the program for testing.

如果您希望程序在生产环境中重新启动,同时仍保持重新启动条件不妨碍开发和测试,可以取消选择Application Engine程序属性中的Disable Restart复选框。然后,在开发过程中,您可以选择禁用重新启动”复选框,或者使用-DR Y选项从命令行调用程序,而不必重新配置程序以进行测试。

  • 31
    点赞
  • 23
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值