-
Notifications
You must be signed in to change notification settings - Fork 0
/
project.gcl
59 lines (49 loc) · 1.3 KB
/
project.gcl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
@include("backend");
use importer;
use runtime;
use io;
use model;
//Your apps entry point
fn main() {
// If graph entry point is not defined start the local data import
if (contracts_by_name == null) {
// Will be displayed on the cl to inform the user we are loading data
println("Importing Data ...");
importLocalData();
}
//Check if the api key is present, if so start the scheduler
var key = File::open("api_key.txt");
if (key != null) {
startImportingScheduler();
}
}
@expose
@write
fn startImportingScheduler() {
var periodicStationTask = PeriodicTask {
arguments: null,
every: 5_min,
user_id: 1,
function: importer::importStations,
start: time::now()
};
var periodicContractTask = PeriodicTask {
arguments: null,
every: 1_day,
user_id: 1,
function: importer::importContracts,
start: time::now()
};
//Greycats own integrated job scheduler refer to the documentation for more information unde Features -> Periodic
PeriodicTask::set([periodicContractTask, periodicStationTask]);
}
//Boostrap the data, for demo purposes
@write
fn importLocalData() {
importData();
importRecords();
}
fn exportLocalData() {
exportData();
exportRecords();
}