File: database-scheme.rst

package info (click to toggle)
oar 2.6.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 9,700 kB
  • sloc: perl: 34,517; sh: 6,041; ruby: 5,840; sql: 3,390; cpp: 2,277; makefile: 402; php: 365; ansic: 335; python: 275; exp: 23
file content (816 lines) | stat: -rw-r--r-- 35,461 bytes parent folder | download | duplicates (7)
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
Database scheme
===============

.. figure:: ../_static/db_scheme.png
   :target: ../_static/db_scheme.svg
   :alt: Database scheme

   Database scheme
   (red lines seem PRIMARY KEY,
   blue lines seem INDEX)

Note : all dates and duration are stored in an integer manner (number of
seconds since the EPOCH).

.. _database-accounting-anchor:

accounting
----------

==================  ====================  =======================================
Fields              Types                 Descriptions
==================  ====================  =======================================
window_start        INT UNSIGNED          start date of the accounting interval
window_stop         INT UNSIGNED          stop date of the accounting interval
accounting_user     VARCHAR(20)           user name
accounting_project  VARCHAR(255)          name of the related project
queue_name          VARCHAR(100)          queue name
consumption_type    ENUM("ASKED",         "ASKED" corresponds to the walltimes
                    "USED")               specified by the user. "USED"
                                          corresponds to the effective time
                                          used by the user.
consumption         INT UNSIGNED          number of seconds used
==================  ====================  =======================================

:Primary key: window_start, window_stop, accounting_user, queue_name,
              accounting_project, consumption_type
:Index fields: window_start, window_stop, accounting_user, queue_name,
               accounting_project, consumption_type

This table is a summary of the consumption for each user on each queue. This
increases the speed of queries about user consumptions and statistic
generation.

Data are inserted through the command :doc:`commands/oaraccounting` (when a job is treated
the field *accounted* in table jobs is passed into "YES"). So it is possible to
regenerate this table completely in this way :

 - Delete all data of the table:
   ::

       DELETE FROM accounting;

 - Set the field *accounted* in the table jobs to "NO" for each row:
   ::

       UPDATE jobs SET accounted = "NO";

 - Run the :doc:`commands/oaraccounting` command.

You can change the amount of time for each window : edit the oar configuration
file and change the value of the tag :ref:`ACCOUNTING_WINDOW <ACCOUNTING_WINDOW>`.

.. _database-schema-anchor:

schema
------

================  ====================  =======================================
Fields            Types                 Descriptions
================  ====================  =======================================
version           VARCHAR(255)          database schema version number
name              VARCHAR(255)          optional name
================  ====================  =======================================

This table is used to store the version of the database schema.

So the oar-database command be used to automatically upgrade the schema from
any version with::

    oar-database --setup

.. _database-admission-rules-anchor:

admission_rules
---------------

================  ====================  =======================================
Fields            Types                 Descriptions
================  ====================  =======================================
id                INT UNSIGNED          id number
rule              TEXT                  rule written in Perl applied when a
                                        job is going to be registered
================  ====================  =======================================

:Primary key: id
:Index fields: *None*

You can use these rules to change some values of some properties when a job is
submitted. So each admission rule is executed in the order of the id field and
it can set several variables. If one of them exits then the others will not
be evaluated and oarsub returns an error.

The rules can be added with the following command:
::

    oaradmissionrules -n

Some examples are better than a long description:

 - Specify the default value for queue parameter
   ::

        if (not defined($queue_name)) {
            $queue_name="default";
        }

 - Avoid users except oar to go in the admin queue
   ::

        if (($queue_name eq "admin") && ($user ne "oar")) {
          die("[ADMISSION RULE] Only oar user can submit jobs in the admin queue\n");
        }

 - Restrict the maximum of the walltime for interactive jobs
   ::

        my $max_walltime = OAR::IO::sql_to_duration("12:00:00");
        if ($jobType eq "INTERACTIVE"){
          foreach my $mold (@{$ref_resource_list}){
            if (
              (defined($mold->[1])) and
              ($max_walltime < $mold->[1])
            ){
              print("[ADMISSION RULE] Walltime to big for an INTERACTIVE job so it is set to $max_walltime.\n");
              $mold->[1] = $max_walltime;
            }
          }
        }

 - Specify the default walltime
   ::

      my $default_wall = OAR::IO::sql_to_duration("2:00:00");
      foreach my $mold (@{$ref_resource_list}){
        if (!defined($mold->[1])){
          print("[ADMISSION RULE] Set default walltime to $default_wall.\n");
          $mold->[1] = $default_wall;
        }
      }

 - How to perform actions if the user name is in a file
   ::

      open(FILE, "/tmp/users.txt");
      while (($queue_name ne "admin") and ($_ = <FILE>)){
        if ($_ =~ m/^\\s*$user\\s*$/m){
          print("[ADMISSION RULE] Change assigned queue into admin\n");
          $queue_name = "admin";
        }
      }
      close(FILE);

 - How to automatically add a job type depending of the walltime and an
   estimation of the number of resources of the job
   ::

      foreach my $e (estimate_job_nb_resources($dbh_ro, $ref_resource_list, $jobproperties)){
        #print("AREA: $e->{nbresources} x $e->{walltime} = ".$e->{nbresources} * $e->{walltime}."\n");
        if ($e->{nbresources} * $e->{walltime} > 24*3600*1){
          print("[ADMISSION RULE] Your job is of the 'big' type\n");
          push(@{$type_list},"big");
          last;
        }
      }

You can print all the admission rules with::

    oaradmissionrules -S -f


.. _database-event-logs-anchor:

event_logs
----------

================  ====================  =======================================
Fields            Types                 Descriptions
================  ====================  =======================================
event_id          INT UNSIGNED          event identifier
type              VARCHAR(50)           event type
job_id            INT UNSIGNED          job related of the event
date              INT UNSIGNED          event date
description       VARCHAR(255)          textual description of the event
to_check          ENUM('YES', 'NO')     specify if the module *NodeChangeState*
                                        must check this event to Suspect or not
                                        some nodes
================  ====================  =======================================

:Primary key: event_id
:Index fields: type, to_check

The different event types are:

 - "PING_CHECKER_NODE_SUSPECTED" : the system detected via the module "finaud"
   that a node is not responding.
 - "PROLOGUE_ERROR" : an error occurred during the execution of the job
   prologue (exit code != 0).
 - "EPILOGUE_ERROR" : an error occurred during the execution of the job
   epilogue (exit code != 0).
 - "CANNOT_CREATE_TMP_DIRECTORY" : OAR cannot create the directory where all
   information files will be stored.
 - "CAN_NOT_WRITE_NODE_FILE" : the system was not able to write file which had
   to contain the node list on the first node (*/tmp/OAR_job_id*).
 - "CAN_NOT_WRITE_PID_FILE" : the system was not able to write the file which
   had to contain the pid of oarexec process on the first node
   (*/tmp/pid_of_oarexec_for_job_id*).
 - "USER_SHELL" : the system was not able to get informations about the user
   shell on the first node.
 - "EXIT_VALUE_OAREXEC" : the oarexec process terminated with an unknown exit
   code.
 - "SEND_KILL_JOB" : signal that OAR has transmitted a kill signal to the
   oarexec of the specified job.
 - "LEON_KILL_BIPBIP_TIMEOUT" : Leon module has detected that something wrong
   occurred during the kill of a job and so kill the local *bipbip* process.
 - "EXTERMINATE_JOB" : Leon module has detected that something wrong occurred
   during the kill of a job and so clean the database and terminate the job
   artificially.
 - "WORKING_DIRECTORY" : the directory from which the job was submitted does
   not exist on the node assigned by the system.
 - "OUTPUT_FILES" : OAR cannot write the output files (stdout and stderr) in
   the working directory.
 - "CANNOT_NOTIFY_OARSUB" : OAR cannot notify the `oarsub` process for an
   interactive job (maybe the user has killed this process).
 - "WALLTIME" : the job has reached its walltime.
 - "SCHEDULER_REDUCE_NB_NODES_FOR_RESERVATION" : this means that there is not
   enough nodes for the reservation and so the scheduler do the best and
   gives less nodes than the user wanted (this occurres when nodes become
   Suspected or Absent).
 - "BESTEFFORT_KILL" : the job is of the type *besteffort* and was killed
   because a normal job wanted the nodes.
 - "FRAG_JOB_REQUEST" : someone wants to delete a job.
 - "CHECKPOINT" : the checkpoint signal was sent to the job.
 - "CHECKPOINT_ERROR" : OAR cannot send the signal to the job.
 - "CHECKPOINT_SUCCESS" : system has sent the signal correctly.
 - "SERVER_EPILOGUE_TIMEOUT" : epilogue server script has time outed.
 - "SERVER_EPILOGUE_EXIT_CODE_ERROR" : epilogue server script did not return 0.
 - "SERVER_EPILOGUE_ERROR" : cannot find epilogue server script file.
 - "SERVER_PROLOGUE_TIMEOUT" : prologue server script has time outed.
 - "SERVER_PROLOGUE_EXIT_CODE_ERROR" : prologue server script did not return 0.
 - "SERVER_PROLOGUE_ERROR" : cannot find prologue server script file.
 - "CPUSET_CLEAN_ERROR" : OAR cannot clean correctly cpuset files for a job
   on the remote node.
 - "MAIL_NOTIFICATION_ERROR" : a mail cannot be sent.
 - "USER_MAIL_NOTIFICATION" : user mail notification cannot be performed.
 - "USER_EXEC_NOTIFICATION_ERROR" : user script execution notification cannot
   be performed.
 - "BIPBIP_BAD_JOBID" : error when retrieving informations about a running job.
 - "BIPBIP_CHALLENGE" : OAR is configured to detach jobs when they are launched
   on compute nodes and the job return a bad challenge number.
 - "RESUBMIT_JOB_AUTOMATICALLY" : the job was automatically resubmitted.
 - "WALLTIME" : the job reached its walltime.
 - "REDUCE_RESERVATION_WALLTIME" : the reservation job was shrunk.
 - "SSH_TRANSFER_TIMEOUT" : node OAR part script was too long to transfer.
 - "BAD_HASHTABLE_DUMP" : OAR transfered a bad hashtable.
 - "LAUNCHING_OAREXEC_TIMEOUT" : oarexec was too long to initialize itself.
 - "RESERVATION_NO_NODE" : All nodes were detected as bad for the reservation
   job.


.. _database-event-log-hostnames-anchor:

event_log_hostnames
-------------------

================  ====================  =======================================
Fields            Types                 Descriptions
================  ====================  =======================================
event_id          INT UNSIGNED          event identifier
hostname          VARCHAR(255)          name of the node where the event
                                        has occured
================  ====================  =======================================

:Primary key: event_id
:Index fields: hostname

This table stores hostnames related to events like
"PING_CHECKER_NODE_SUSPECTED".

.. _database-files-anchor:

files
-----

================  ====================  =======================================
Fields            Types                 Descriptions
================  ====================  =======================================
idFile            INT UNSIGNED
md5sum            VARCHAR(255)
location          VARCHAR(255)
method            VARCHAR(255)
compression       VARCHAR(255)
size              INT UNSIGNED
================  ====================  =======================================

:Primary key: idFile
:Index fields: md5sum


.. _database-frag-jobs-anchor:

frag_jobs
---------

================  ==========================  =================================
Fields            Types                       Descriptions
================  ==========================  =================================
frag_id_job       INT UNSIGNED                job id
frag_date         INT UNSIGNED                kill job decision date
frag_state        ENUM('LEON', 'TIMER_ARMED'  state to tell Leon what to do
                  , 'LEON_EXTERMINATE',
                  'FRAGGED')
                  DEFAULT 'LEON'
================  ==========================  =================================

:Primary key: frag_id_job
:Index fields: frag_state

What do these states mean:

 - "LEON" : the Leon module must try to kill the job and change the state into
   "TIMER_ARMED".
 - "TIMER_ARMED" : the Sarko module must wait a response from the job during
   a timeout (default is 60s)
 - "LEON_EXTERMINATE" : the Sarko module has decided that the job time outed and
   asked Leon to clean up the database.
 - "FRAGGED" : job is fragged.

.. _database-gantt-jobs-resources-anchor:

gantt_jobs_resources
--------------------

================  ====================  =======================================
Fields            Types                 Descriptions
================  ====================  =======================================
moldable_job_id   INT UNSIGNED          moldable job id
resource_id       INT UNSIGNED          resource assigned to the job
================  ====================  =======================================

:Primary key: moldable_job_id, resource_id
:Index fields: *None*

This table specifies which resources are attributed to which jobs.

.. _database-gantt-jobs-resources-visu-anchor:

gantt_jobs_resources_visu
-------------------------

================  ====================  =======================================
Fields            Types                 Descriptions
================  ====================  =======================================
moldable_job_id   INT UNSIGNED          moldable job id
resource_id       INT UNSIGNED          resource assigned to the job
================  ====================  =======================================

:Primary key: moldable_job_id, resource_id
:Index fields: *None*

This table is the same as `gantt_jobs_resources`_ and is used by visualisation
tools. It is updated atomically (a lock is used).


.. _database-gantt-jobs-predictions-anchor:

gantt_jobs_predictions
----------------------

================  ====================  =======================================
Fields            Types                 Descriptions
================  ====================  =======================================
moldable_job_id   INT UNSIGNED          job id
start_time        INT UNSIGNED          date when the job is scheduled to start
================  ====================  =======================================

:Primary key: moldable_job_id
:Index fields: *None*

With this table and `gantt_jobs_resources`_ you can know exactly what are the
decisions taken by the schedulers for each waiting jobs.

:note: The special job id "0" is used to store the scheduling reference date.

.. _database-gantt-jobs-predictions-visu-anchor:

gantt_jobs_predictions_visu
---------------------------

================  ====================  =======================================
Fields            Types                 Descriptions
================  ====================  =======================================
moldable_job_id   INT UNSIGNED          job id
start_time        INT UNSIGNED          date when the job is scheduled to start
================  ====================  =======================================

:Primary key: job_id
:Index fields: *None*

This table is the same as `gantt_jobs_predictions`_ and is used by visualisation
tools. It is made up to date in an atomic action (with a lock).

.. _database-jobs-anchor:

jobs
----

===================== ======================  =======================================
Fields                Types                   Descriptions
===================== ======================  =======================================
job_id                INT UNSIGNED            job identifier
array_id              INT                     array identifier
array_index           INT                     index of the job in the array
initial_request       TEXT                    oarsub initial arguments
job_name              VARCHAR(100)            name given by the user
cpuset_name           VARCHAR(255)            name of the cpuset directory used for
                                              this job on each nodes
job_type              ENUM('INTERACTIVE',     specify if the user wants to launch a
                      'PASSIVE') DEFAULT      program or get an interactive shell
                      'PASSIVE'
info_type              VARCHAR(255)           some informations about `oarsub`
                                              command
state                 ENUM('Waiting','Hold',  job state
                      'toLaunch', 'toError',
                      'toAckReservation',
                      'Launching', 'Running'
                      'Suspended',
                      'Resuming',
                      , 'Finishing',
                      'Terminated', 'Error')
reservation           ENUM('None',            specify if the job is a reservation
                      'toSchedule',           and the state of this one
                      'Scheduled') DEFAULT
                      'None'
message               VARCHAR(255)            readable information message for the
                                              user
job_user              VARCHAR(255)             user name
command               TEXT                    program to run
queue_name            VARCHAR(100)            queue name
properties            TEXT                    properties that assigned nodes must
                                              match
launching_directory   TEXT                    path of the directory where to launch
                                              the user process
submission_time       INT UNSIGNED            date when the job was submitted
start_time            INT UNSIGNED            date when the job was launched
stop_time             INT UNSIGNED            date when the job was stopped
file_id               INT UNSIGNED
accounted             ENUM("YES", "NO")       specify if the job was considered by
                      DEFAULT "NO"            the accounting mechanism or not
notify                VARCHAR(255)            gives the way to notify the user about
                                              the job (mail or script )
assigned_moldable_job INT UNSIGNED            moldable job chosen by the scheduler
checkpoint            INT UNSIGNED            number of seconds before the walltime
                                              to send the checkpoint signal to the
                                              job
checkpoint_signal     INT UNSIGNED            signal to use when checkpointing the
                                              job
stdout_file           TEXT                    file name where to redirect program
                                              STDOUT
stderr_file           TEXT                    file name where to redirect program
                                              STDERR

resubmit_job_id       INT UNSIGNED            if a job is resubmitted then the new
                                              one store the previous
project               VARCHAR(255)            arbitrary name given by the user or an
                                              admission rule
suspended             ENUM("YES","NO")        specify if the job was suspended
                                              (oarhold)
job_env               TEXT                    environment variables to set for the
                                              job
exit_code             INT DEFAULT 0           exit code for passive jobs
job_group             VARCHAR(255)            not used
===================== ======================  =======================================

:Primary key: job_id
:Index fields: state, reservation, queue_name, accounted, suspended

Explications about the "state" field:

 - "Waiting" : the job is waiting OAR scheduler decision.
 - "Hold" : user or administrator wants to hold the job (`oarhold` command).
   So it will not be scheduled by the system.
 - "toLaunch" : the OAR scheduler has attributed some nodes to the job. So it
   will be launched.
 - "toError" : something wrong occurred and the job is going into the error
   state.
 - "toAckReservation" : the OAR scheduler must say "YES" or "NO" to the waiting
   `oarsub` command because it requested a reservation.
 - "Launching" : OAR has launched the job and will execute the user command
   on the first node.
 - "Running" : the user command is executing on the first node.
 - "Suspended" : the job was in Running state and there was a request
   (`oarhold` with "-r" option) to suspend this job. In this state other jobs
   can be scheduled on the same resources (these resources has the
   "suspended_jobs" field to "YES").
 - "Finishing" : the user command has terminated and OAR is doing work internally
 - "Terminated" : the job has terminated normally.
 - "Error" : a problem has occurred.

Explications about the "reservation" field:

 - "None" : the job is not a reservation.
 - "toSchedule" : the job is a reservation and must be approved by the
   scheduler.
 - "Scheduled" : the job is a reservation and is scheduled by OAR.

.. _database-job-dependencies-anchor:

job_dependencies
----------------

================  ====================  =======================================
Fields            Types                 Descriptions
================  ====================  =======================================
job_id            INT UNSIGNED          job identifier
job_id_required   INT UNSIGNED          job needed to be completed before
                                        launching job_id
================  ====================  =======================================

:Primary key: job_id, job_id_required
:Index fields: job_id, job_id_required

This table is feeded by `oarsub` command with the "-a" option.

.. _database-moldable-job-descriptions-anchor:

moldable_job_descriptions
-------------------------

=================  ====================  =======================================
Fields             Types                 Descriptions
=================  ====================  =======================================
moldable_id        INT UNSIGNED          moldable job identifier
moldable_job_id    INT UNSIGNED          corresponding job identifier
moldable_walltime  INT UNSIGNED          instance duration
=================  ====================  =======================================

:Primary key: moldable_id
:Index fields: moldable_job_id

A job can be described with several instances. Thus OAR scheduler can choose one
of them. For example it can calculate which instance will finish first.
So this table stores all instances for all jobs.

.. _database-job-resource-groups-anchor:

job_resource_groups
-------------------

===================== ====================  =======================================
Fields                Types                 Descriptions
===================== ====================  =======================================
res_group_id          INT UNSIGNED          group identifier
res_group_moldable_id INT UNSIGNED          corresponding moldable job identifier
res_group_property    TEXT                  SQL constraint properties
===================== ====================  =======================================

:Primary key: res_group_id
:Index fields: res_group_moldable_id

As you can specify job global properties with `oarsub` and the "-p" option,
you can do the same thing for each resource groups that you define with
the "-l" option.

.. _database-job-resource-descriptions-anchor:

job_resource_descriptions
-------------------------

===================== ====================  =======================================
Fields                Types                 Descriptions
===================== ====================  =======================================
res_job_group_id      INT UNSIGNED          corresponding group identifier
res_job_resource_type VARCHAR(255)          resource type (name of a field in
                                            resources)
res_job_value         INT                   wanted resource number
res_job_order         INT UNSIGNED          order of the request
===================== ====================  =======================================

:Primary key: res_job_group_id, res_job_resource_type, res_job_order
:Index fields: res_job_group_id

This table store the hierarchical resource description given with `oarsub` and
the "-l" option.


.. _database-job-state-logs-anchor:

job_state_logs
--------------

=================  ====================  =======================================
Fields             Types                 Descriptions
=================  ====================  =======================================
job_state_log_id   INT UNSIGNED          identifier
job_id             INT UNSIGNED          corresponding job identifier
job_state          ENUM('Waiting',       job state during the interval
                   'Hold', 'toLaunch',
                   'toError',
                   'toAckReservation',
                   'Launching',
                   'Finishing',
                   'Running',
                   'Suspended',
                   'Resuming',
                   'Terminated',
                   'Error')
date_start         INT UNSIGNED          start date of the interval
date_stop          INT UNSIGNED          end date of the interval
=================  ====================  =======================================

:Primary key: job_state_log_id
:Index fields: job_id, job_state

This table keeps informations about state changes of jobs.

.. _database-job-types-anchor:

job_types
---------

================  ====================  =======================================
Fields            Types                 Descriptions
================  ====================  =======================================
job_type_id       INT UNSIGNED          identifier
job_id            INT UNSIGNED          corresponding job identifier
type              VARCHAR(255)          job type like "deploy", "timesharing",
                                        ...
type_index        ENUM('CURRENT',       index field
                  'LOG')
================  ====================  =======================================

:Primary key: job_type_id
:Index fields: job_id, type

This table stores job types given with the `oarsub` command and "-t" options.

.. _database-resources-anchor:

resources
---------

====================  ====================  =======================================
Fields                Types                 Descriptions
====================  ====================  =======================================
resource_id           INT UNSIGNED          resource identifier
type                  VARCHAR(100)          resource type (used for licence
                      DEFAULT "default"     resources for example)
network_address       VARCHAR(100)          node name (used to connect via SSH)
state                 ENUM('Alive', 'Dead'  resource state
                      , 'Suspected',
                      'Absent')
next_state            ENUM('UnChanged',     state for the resource to switch
                      'Alive', 'Dead',
                      'Absent',
                      'Suspected') DEFAULT
                      'UnChanged'
finaud_decision       ENUM('YES', 'NO')     tell if the actual state results in a
                      DEFAULT 'NO'          "finaud" module decision
next_finaud_decision  ENUM('YES', 'NO')     tell if the next node state results in
                      DEFAULT 'NO'          a "finaud" module decision
state_num             INT                   corresponding state number (useful
                                            with the SQL "ORDER" query)
suspended_jobs        ENUM('YES','NO')      specify if there is at least one
                                            suspended job on the resource
scheduler_priority    INT UNSIGNED          arbitrary number given by the system
                                            to select resources with more
                                            intelligence
switch                VARCHAR(50)           name of the switch
cpu                   INT UNSIGNED          global cluster cpu number
cpuset                INT UNSIGNED          field used with the
                                            :ref:`JOB_RESOURCE_MANAGER_PROPERTY_DB_FIELD <JOB_RESOURCE_MANAGER_PROPERTY_DB_FIELD>`
besteffort            ENUM('YES','NO')      accept or not besteffort jobs
deploy                ENUM('YES','NO')      specify if the resource is deployable
expiry_date           INT UNSIGNED          field used for the desktop computing
                                            feature
desktop_computing     ENUM('YES','NO')      tell if it is a desktop computing
                                            resource (with an agent)
last_job_date         INT UNSIGNED          store the date when the resource
                                            was used for the last time
available_upto        INT UNSIGNED          used with compute mode features to
                                            know if an Absent resource can be
                                            switch on
====================  ====================  =======================================

:Primary key: resource_id
:Index fields: state, next_state, type, suspended_jobs

State explications:

 - "Alive" : the resource is ready to accept a job.
 - "Absent" : the oar administrator has decided to pull out the resource. This
   computer can come back.
 - "Suspected" : OAR system has detected a problem on this resource and so has
   suspected it (you can look in the :ref:`database-event-logs-anchor` table to know what has
   happened). This computer can come back (automatically if this is a
   "finaud" module decision).
 - "Dead" : The oar administrator considers that the resource will not come back
   and will be removed from the pool.

This table permits to specify different properties for each resources. These can
be used with the `oarsub` command ("-p" and "-l" options).

You can add your own properties with :doc:`commands/oarproperty` command.

These properties can be updated with the :doc:`commands/oarnodesetting` command ("-p" option).

Several properties are added by default:

 - switch : you have to register the name of the switch where the node is
   plugged.
 - cpu : this is a unique name given to each cpus. This enables OAR scheduler
   to distinguish all cpus.
 - cpuset : this is the name of the cpu on the node. The Linux kernel sets this
   to an integer beginning at 0. This field is linked to the configuration tag
   :ref:`JOB_RESOURCE_MANAGER_PROPERTY_DB_FIELD <JOB_RESOURCE_MANAGER_PROPERTY_DB_FIELD>`.

.. _database-resource-logs-anchor:

resource_logs
-------------

=================  ====================  =======================================
Fields             Types                 Descriptions
=================  ====================  =======================================
resource_log_id    INT UNSIGNED          unique id
resource_id        INT UNSIGNED          resource identifier
attribute          VARCHAR(255)          name of corresponding field in
                                         resources
value              VARCHAR(255)          value of the field
date_start         INT UNSIGNED          interval start date
date_stop          INT UNSIGNED          interval stop date
finaud_decision    ENUM('YES','NO')      store if this is a system change or a
                                         human one
=================  ====================  =======================================

:Primary key: *None*
:Index fields: resource_id, attribute

This table permits to keep a trace of every property changes (consequence of
the :doc:`commands/oarnodesetting` command with the "-p" option).

.. _database-assigned-resources-anchor:

assigned_resources
------------------

================  ====================  =======================================
Fields            Types                 Descriptions
================  ====================  =======================================
moldable_job_id   INT UNSIGNED          job id
resource_id       INT UNSIGNED          resource assigned to the job
================  ====================  =======================================

:Primary key: moldable_job_id, resource_id
:Index fields: moldable_job_id

This table keeps informations for jobs on which resources they were
scheduled.

.. _database-queues-anchor:

queues
------

================  ====================  =======================================
Fields            Types                 Descriptions
================  ====================  =======================================
queue_name        VARCHAR(100)          queue name
priority          INT UNSIGNED          the scheduling priority
scheduler_policy  VARCHAR(100)          path of the associated scheduler
state             ENUM('Active',        permits to stop the scheduling for a
                  'notActive')          queue
                  DEFAULT 'Active'
================  ====================  =======================================

:Primary key: queue_name
:Index fields: *None*

This table contains the schedulers executed by the *oar_meta_scheduler* module.
Executables are launched one after one in the specified priority.

.. _database-challenges-anchor:

challenges
----------

================  ====================  =======================================
Fields            Types                 Descriptions
================  ====================  =======================================
job_id            INT UNSIGNED          job identifier
challenge         VARCHAR(255)          challenge string
ssh_private_key   TEXT DEFAULT NULL     ssh private key given by the user
                                        (in grid usage it enables to connect
                                        onto all nodes of the job of all
                                        clusers with oarsh)
ssh_public_key    TEXT DEFAULT NULL     ssh public key
================  ====================  =======================================

:Primary key: job_id
:Index fields: *None*

This table is used to share a secret between OAR server and oarexec process on
computing nodes (avoid a job id being stolen/forged by malicious user).

For security reasons, this table **must not be readable** for a database
account given to users who want to access OAR internal informations(like statistics).