150 likes | 791 Views
Daily Batch Process for Demand Forecasting. 2019-01-16. Uploads and Imports. Prepare a roadmap of your batch processes – files, queries, import actions / processes in Anaplan. Consistent Naming. Script name BAT-01a Product Hierarchy.bat
E N D
Daily Batch Process for Demand Forecasting 2019-01-16
Uploads and Imports Prepare a roadmap of your batch processes – files, queries, import actions / processes in Anaplan
Consistent Naming • Script name BAT-01a Product Hierarchy.bat • Anaplan Action (Process) name BAT-01a Product Hierarchy • Reject log name BAT-01a Product Hierarchy.log • AC Process log nameBAT-01a Product Hierarchy 2019-01-16 0800.log
Don’t Rename Data Hub Processes! • Use Anaplan Processes as wrappers for import actions. • Import job scripts have the name of the Anaplan Process hardcoded in them. • It is okay to rename Import Actions. Just don’t change Process names.
Other Tasks • Pre-import processing Test for file creation process completion, notify Anaplan admin if upstream job was delayed Copy files to an upload folder. Avoids a potential conflict when file processing is delayed. Set current date • Post-import processing Cancelled order purge Delete files from upload folder Email notification of process completion Kill hanging java.exe sessions after 30 minutes (Short-term workaround for AC 1.4 bug)
Anaplan Connect versions (as of Jan 2019) • 1.3.3.5 – Most stable, but missing 2 key features. No CA Certificate authentication No jdbc.properties • 1.4 – Hangs in one specific type of reject Bug: cmd and java.exe threads left hanging on specific duplicate record reject Workaround: Kill scheduled jobs after 30 minutes and kill all java.exe after batch is done. • 1.4.1 Due out Feb 2019. Should be best of all worlds. Okay to have some of each: 1.3.3.5 for BI File uploads and 1.4 for SQL queries Recommend consolidating to 1.4.1 when released.
Anaplan Service Account A service account like svcanaplan@customer.com is used to login to Anaplan in all scheduled batch jobs. This account has an Outlook email box … necessary for setting up the account in Anaplan and for password resets. Anaplan Connect does NOT support SSO. This account’s Anaplan password is maintained in Anaplan and will expire every 90 days. SET AN OUTLOOK REMINDER TO UPDATE PASSWORD APRIL 1 AND REPEATING AT 90 DAY INTERVALS. Store info like login credentials and connect strings for jdbc in a GlobalVariables.bat file on Windows server … single place to update when it expires. Future state: CA Certificate authentication with certificate that expires once a year. More secure, less maintenance. Requires AC 1.4+ only (wait for next release due in Feb).
Anaplan Connect Scripts • Set variables unique to this job. File, SQL query, Action, Log Name • Get connection info from Globals.bat • If SQL, run CreateJDBC.Properties.bat • Assemble the OPERATION= line Connection, upload, action, and reject log flags • Run AnaplanClient.bat, record the chatter to process log file • Check ERRORLEVEL and log for errors, send email if trouble • Exit
CreateJDBCProperties.bat • Custom script collects connection, credentials, and SQL query information from other files and assembles a short-lived plaintext file for Anaplan Connect’s needs. • Globals.bat contains connection and credentials. Intention is to encrypt that file to avoid plaintext password storage. • SQLQueries.txt contains the SQL statements* used by jobs: ::QueryName Select ABC, DEF From Table Where GHI<0 ::end * No double quotes allowed in SQLQueries.txt, other special characters (<>=&|) are ok.
CreateJDBCProperties info online A best practices forum post in Community.Anaplan.com contains full details.https://community.anaplan.com/t5/Best-Practices/Windows-cmd-shell-script-for-dynamically-generating-JDBC
Logging • Import action rejects (if any) are saved to file in\\<servername>\Anaplan\ErrorLogs\ • Process “chatter” while AnaplanClient is interacting with Oracle and Anaplan is captured on the Windows server atD:\Anaplan\ProcessLogs\Process logs are named with <job name> <date> <start time>.log • History in Anaplan
Rejected Record Logs • Same information as found on Details tab after a manual import into Anaplan. • No rejects or warnings = no file. • Reject files are overwritten daily. No retention. • Could add Date Time to filename and retain for 30 days, same as Process Logs.
Process Logs • Connection • SQL query • Upload • Import – summary stats • To List • To Module Process logs are retained for 30 days to allow some forensics on past trouble or performance changes.
Scheduling • Windows Task Scheduler on Windows server Simple scheduler, limited features. Most data centers have a more robust solution that monitors errors and notifies support team, branches on conditions, handles job dependencies… Setting jobs up can be a significant project. • Two primary jobs start at 8 am File import jobs (AC 1.3.3.5) SQL jobs (AC 1.4) These could be merged after AC 1.4.1 is released with bug fix. • Cleanup task at 8:30 to delete copies of data files and kill java.exe threads (bug workaround)