Skip to main content

Notifications

Announcements

No record found.

Dynamics 365 general forum
Unanswered

Perform Job re-run from the code

(0) ShareShare
ReportReport
Posted on by 10

Hello! 
I often encounter a problem where multiple entities cannot successfully boot into d365 for unknown reason (off-topic question). In such cases I use "Copy data to target" tab 
then I choose "Run for criteria" and enable checkbox "Rows with previous errors"
 
After these steps failed jobs are successfully reprocessed.

So my question is - is there any options how can I do the same operation from code? I mean HTTP (maybe OData) request.

Thanks!

Categories:
  • Perform Job re-run from the code

    Performing a job re-run from code depends on the context and the specific technology or platform you're working with. Below are some general guidelines, but keep in mind that the exact steps may vary based on the system or programming language you are using.

    General Steps:

    1. Identify the Job:

      • Determine which job you want to re-run. This could be a script, a batch job, or any process that needs to be executed again.
    2. Code Modification:

      • If necessary, modify the code to handle the re-run scenario. This might involve resetting variables, clearing caches, or addressing any specific requirements for a clean re-run.
    3. Logging and Debugging:

      • Ensure that your code has proper logging and debugging mechanisms. This will help you identify issues if the re-run encounters errors.
    4. Automation and Orchestration Tools:

      • If your job is part of a larger workflow managed by an automation or orchestration tool (e.g., Apache Airflow, Jenkins), you may trigger a re-run through the respective tool's interface or API.

    Example in Python:

    Assuming you have a Python script that you want to re-run, you might follow these steps:

    def main():
    # Your existing code here
    
    if __name__ == "__main__":
    # Call the main function
    main()

    To perform a re-run, you can encapsulate the main logic within a function and call it as needed. For example:

     
    python
    def main():
    # Your existing code here

    if __name__ == "__main__":
    # Call the main function for the initial run
    main()

    # Perform a re-run
    re_run_required = True # Set this to True when re-run is needed
    if re_run_required:
    main()

    This is a simplified example, and the exact implementation depends on the specifics of your code and requirements.

    Specific Platforms:

    If you're working with a specific platform or framework, such as Apache Spark, Hadoop, or a cloud-based solution, the steps and APIs for re-running jobs may differ. In such cases, refer to the documentation of the specific technology you're using for guidance on job re-runs.

Helpful resources

Quick Links

Community Spotlight of the Month

Kudos to Mohamed Amine Mahmoudi!

Blog subscriptions now enabled!

Follow your favorite blogs

TechTalk: How Dataverse and Microsoft Fabric powers ...

Explore the latest advancements in data export and integration within ...

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 284,876 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 225,425 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,146

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans