-
Notifications
You must be signed in to change notification settings - Fork 34
CSM BDS python scripts don't work with --starttime or --endtime #992
Comments
A change made in the query to replace
However, A possible workaround for the problem is to create a new index that has the same fields as But, the new index has a different name. Therefore, the current Never the less, the
That caused Exceptions:
Pending for further investigation...... |
For debugging purposes, we deleted the cast-allocation index in elasticsearch. Then, a new cast-allocation was created with the two fields (begin_time, data.end_time) now have type "date". With this new index, the incoming data also needs to have the correct date format. The data sources for cast-allocation are from CSM transaction log, which can be manually edited to get the two fields in the correct format. For example:
A T letter has to be added to replace the space between date and time:
As a result, following simple script shows that the time range query works:
|
Another script that mimics how the python scripts query for "--starttime" and "--endtime" also works.
|
A note on how the python scripts query for "--starttime" and "--endtime" as following example:
A and B need to have the correct date and time format like the one in transaction log. That turns out to be a elasticsearch date format:
The recommendation is: always input A and B. Leaving B out will result in following query:
In other word, the query will return all allocations from time A to "now". It's important to note: |
We need to find out where or how the allocation records are written into transaction log so that the data for CSM |
Bill and I had done some sources digging and it seems the following two programs write allocation records to transaction log:
We just have to replace the ' ' with 'T' in Another observation: |
I found a way to load a new index mapping for cast-allocation on-the-fly. With the manually modified date format for begin_time and end_time, the python scripts seem to work at least with the date. For example, following command returned two allocation records in Jan:
Increasing the starttime did exclude the first record and return only the second record:
|
Searching for the CSM code that writes allocation records to the transaction log is a daunting task that requires understanding the design and structure of CSM sources. It also took quite some searching, reading, understanding, try-outs and errors on elasticsearch online docs. But I finally made a break through with a fix by adding a
The
This is definitely a better solution than having CSM write the new date format into transaction log. It doesn't require changes in CSM source or log files. |
For verification, after inserting the new mutate filter into
Notice that the date+time format remains the same, with a blank between date and time. However, a python script that searches for user jobs will display the date+time format with the letter T between date and time. That means the fix has written the correct format into
Before the fix, those date+time would have had a blank in place of T. |
As discovered in a comment earlier:
The date+time format in the Found the time format defined in
This change eliminates calls of
Before the change:
After the change to use nanos:
|
@williammorrison2 found another script that has problem with time format "epoch_millis | nanos".
But, it is defined in a different way, not from
That should be changed to the following format for compatible with nanos.
|
Describe the bug
Regardless of the date entered with
--starttime
or--endtime
, a script queries and returns all job or allocation records. The scriptfindUserJobs.py
is used here as example. All other scripts that support--starttime
and--endtime
options have similar issue.To Reproduce
Steps to reproduce the behavior:
./findUserJobs.py --starttime 2021-01-12
to search for jobs started on that date.Expected behavior
For these scripts to work correctly, they should only return the jobs within the time ranges specified with
--starttime
and|or--endtime
.Screenshots
I added some debugged prints in the script to show the time range that it created from the
--starttime
input.And the query the script will send to elasticsearch:
The time ranges and the query look correct. However, the problem is with the two fields
data.begin_time
anddata.history.end_time
which have type "text" or "string". For example:Environment (please complete the following information):
Additional context
Add any other context about the problem here.
Issue Source:
CSM regression tests
The text was updated successfully, but these errors were encountered: