lundi 5 août 2019

Creating a variable/column based on an OR conditon

I have a dataframe. I would like to send an email regarding the status of an entire process. If one task fails in a process, then the entire process is failed. If all tasks succeed in a process, then the process is successful. I've been having some difficulties creating this logic in my code.

Process ID  Task    Execution Date  Execution Time  Start Date  Start Time  End Date    End Time    Status      Emails
1       A   7/30/2019   13:15:00    7/31/2019   9:21:31     7/31/2019   9:21:51     Successful  Not valid for this task.
1       B   7/30/2019   13:15:00    7/31/2019   9:23:41     7/31/2019   9:25:16     Successful  Not valid for this task.
1       C   7/30/2019   13:15:00    7/31/2019   9:28:03     7/31/2019   9:28:28     Successful  Not valid for this task.
1       D   7/30/2019   13:15:00    7/31/2019   9:19:22     7/31/2019   9:20:13     Successful  Not valid for this task.
1       E   7/30/2019   13:15:00    7/31/2019   9:32:20     7/31/2019   9:32:40     Successful  ['user1@gmail.com', 'user2@gmail.com', 'user3@gmail.com']
1       F   7/30/2019   13:15:00    7/31/2019   9:30:15     7/31/2019   9:30:35     Successful  Not valid for this task.
1       G   7/30/2019   13:15:00    7/31/2019   9:17:17     7/31/2019   9:17:42     Successful  Not valid for this task.
1       H   7/30/2019   13:15:00    7/31/2019   9:25:51     7/31/2019   9:26:31     Successful  Not valid for this task.
2       A   8/1/2019    1:00:00     7/31/2019   23:06:22    7/31/2019   23:06:52    Successful  ['user1@gmail.com', 'user2@gmail.com', 'user3@gmail.com']
2       B   8/1/2019    1:00:00     7/31/2019   23:03:30    7/31/2019   23:04:10    Successful  Not valid for this task.
2       C   8/1/2019    1:00:00     7/31/2019   23:01:07    7/31/2019   23:01:37    FAILED  `   Not valid for this task.

I am not sure what is the most effective way of including this logic into my code. Ultimately, this is going to be scaled for over 100+ processes with any number of tasks. Should I keep it as a dataframe or is another data structure better suited? Should a variable be created for the final success status? Ultimately, I want to use the info in the dataframe to send an email based on the emails associated with the process. This is why I want to keep it in the dataframe.

In this scenario, with the logic Process 1 is Successful and Process 2 is FAILED

Aucun commentaire:

Enregistrer un commentaire