Skip to content

Commit 7e7003c

Browse files
author
xedaq
committed
Tweaks and typos
1 parent 40f4b85 commit 7e7003c

File tree

4 files changed

+9
-58
lines changed

4 files changed

+9
-58
lines changed

Diff for: MongoLog.hh

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#include <vector>
1414
#include <atomic>
1515
#include <thread>
16-
#include <filesystem>
16+
#include <experimental/filesystem>
1717

1818
#include <mongocxx/client.hpp>
1919
#include <mongocxx/collection.hpp>
@@ -53,7 +53,7 @@ class MongoLog{
5353
*/
5454

5555
public:
56-
MongoLog(bool LocalFileLogging=false, int DeleteAfterDays, std::string log_dir);
56+
MongoLog(bool LocalFileLogging=false, int DeleteAfterDays=7, std::string log_dir=".");
5757
~MongoLog();
5858

5959
int Initialize(std::string connection_string,
@@ -86,7 +86,7 @@ private:
8686
int fDeleteAfterDays;
8787
int fToday;
8888
std::mutex fMutex;
89-
std::filesystem::path fOutputDir;
89+
std::experimental::filesystem::path fOutputDir;
9090
std::thread fFlushThread;
9191
std::atomic_bool fFlush;
9292
int fFlushPeriod;

Diff for: main.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ void UpdateStatus(std::string suri, std::string dbname, DAQController* controlle
3535
// Put in status update document
3636
auto insert_doc = bsoncxx::builder::stream::document{};
3737
insert_doc << "host" << hostname <<
38-
"time" << duration_cast<milliseconds>(system_clock::now().time_since_epoch()).count()<<
38+
"time" << bsoncxx::types::b_date(system_clock::now())<<
3939
"rate" << controller->GetDataSize()/1e6 <<
4040
"status" << controller->status() <<
4141
"buffer_length" << controller->GetBufferLength() <<
@@ -81,7 +81,7 @@ int main(int argc, char** argv){
8181
if(argc >= 4)
8282
dbname = argv[3];
8383
if (argc >= 5)
84-
log_dir = argc[4];
84+
log_dir = argv[4];
8585

8686
// We will consider commands addressed to this PC's ID
8787
char chostname[HOST_NAME_MAX];

Diff for: monitor/ceph_monitor.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import time
66
from pymongo import MongoClient
77
from pymongo.errors import NotMasterError
8+
import datetime
89
timeout=2
910
factors = {'k': 1e3, 'M': 1e6, 'G': 1e9, 'T': 1e12, 'B': 1, 'MiB': 1e6, 'GiB': 1e9,
1011
'TiB': 1e12, 'kiB': 1e3, 'kB': 1e3, 'objects,': 1}
@@ -52,7 +53,7 @@ def CheckStatus():
5253

5354
result = subprocess.check_output(['ceph', 'status'])
5455
lines = result.decode().split('\n')
55-
ret = {'time' : time.time()*1000}
56+
ret = {'time' : datetime.datetime.utcnow()}
5657
for line in lines:
5758

5859
res_list = [a.strip() for a in line.split(' ') if a != '']
@@ -97,7 +98,7 @@ def CheckStatus():
9798
stat['ceph_available'] = statvfs.f_frsize * statvfs.f_bavail
9899
try:
99100
coll.insert(stat)
100-
except NotMasterError:
101+
except:
101102
pass
102103
time.sleep(timeout)
103104

Diff for: monitor/monitor.py

-51
This file was deleted.

Diff for: monitor/monitor.py

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/live_data/common_software/monitor.py

0 commit comments

Comments
 (0)