Grid Community Toolkit  6.2.1629922860 (tag: v6.2.20210826)
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
globus_gram_job_manager.h
1 /*
2  * Copyright 1999-2009 University of Chicago
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef GLOBUS_DONT_DOCUMENT_INTERNAL
18 
19 #ifndef GLOBUS_GRAM_JOB_MANAGER_INCLUDE
20 #define GLOBUS_GRAM_JOB_MANAGER_INCLUDE
21 
22 /* Includes */
23 #include "globus_common.h"
24 #include "globus_gram_protocol.h"
25 #include "globus_rsl.h"
26 #include "globus_gass_cache.h"
27 #include "globus_gsi_credential.h"
28 
29 /* Defines */
30 
31 #define GLOBUS_GRAM_AUTHZ_CALLOUT_TYPE "globus_gram_jobmanager_authz"
32 
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36 
37 #define GLOBUS_GRAM_JOB_MANAGER_EXPIRATION_ATTR "expiration"
38 
40 extern globus_thread_key_t globus_i_gram_request_key;
41 
42 /* Type definitions */
43 typedef enum
44 {
45  GLOBUS_GRAM_JOB_MANAGER_LOG_FATAL = 1 << 0,
46  GLOBUS_GRAM_JOB_MANAGER_LOG_ERROR = 1 << 1,
47  GLOBUS_GRAM_JOB_MANAGER_LOG_WARN = 1 << 2,
48  GLOBUS_GRAM_JOB_MANAGER_LOG_INFO = 1 << 3,
49  GLOBUS_GRAM_JOB_MANAGER_LOG_DEBUG = 1 << 4,
50  GLOBUS_GRAM_JOB_MANAGER_LOG_TRACE = 1 << 5
51 }
52 globus_gram_job_manager_log_level_t;
53 
54 typedef enum
55 {
56  GLOBUS_GRAM_JOB_MANAGER_STATE_START,
57  GLOBUS_GRAM_JOB_MANAGER_STATE_TWO_PHASE,
58  GLOBUS_GRAM_JOB_MANAGER_STATE_TWO_PHASE_COMMITTED,
59  GLOBUS_GRAM_JOB_MANAGER_STATE_STAGE_IN,
60  GLOBUS_GRAM_JOB_MANAGER_STATE_SUBMIT,
61  GLOBUS_GRAM_JOB_MANAGER_STATE_POLL1,
62  GLOBUS_GRAM_JOB_MANAGER_STATE_POLL2,
63  GLOBUS_GRAM_JOB_MANAGER_STATE_CLOSE_OUTPUT,
64  GLOBUS_GRAM_JOB_MANAGER_STATE_STAGE_OUT,
65  GLOBUS_GRAM_JOB_MANAGER_STATE_TWO_PHASE_END,
66  GLOBUS_GRAM_JOB_MANAGER_STATE_TWO_PHASE_END_COMMITTED,
67  GLOBUS_GRAM_JOB_MANAGER_STATE_FILE_CLEAN_UP,
68  GLOBUS_GRAM_JOB_MANAGER_STATE_SCRATCH_CLEAN_UP,
69  GLOBUS_GRAM_JOB_MANAGER_STATE_CACHE_CLEAN_UP,
70  GLOBUS_GRAM_JOB_MANAGER_STATE_DONE,
71  GLOBUS_GRAM_JOB_MANAGER_STATE_FAILED,
72  GLOBUS_GRAM_JOB_MANAGER_STATE_FAILED_CLOSE_OUTPUT,
73  GLOBUS_GRAM_JOB_MANAGER_STATE_FAILED_TWO_PHASE,
74  GLOBUS_GRAM_JOB_MANAGER_STATE_FAILED_TWO_PHASE_COMMITTED,
75  GLOBUS_GRAM_JOB_MANAGER_STATE_FAILED_FILE_CLEAN_UP,
76  GLOBUS_GRAM_JOB_MANAGER_STATE_FAILED_SCRATCH_CLEAN_UP,
77  GLOBUS_GRAM_JOB_MANAGER_STATE_FAILED_CACHE_CLEAN_UP,
78  GLOBUS_GRAM_JOB_MANAGER_STATE_FAILED_DONE,
79  GLOBUS_GRAM_JOB_MANAGER_STATE_STOP,
80  GLOBUS_GRAM_JOB_MANAGER_STATE_POLL_QUERY1,
81  GLOBUS_GRAM_JOB_MANAGER_STATE_POLL_QUERY2,
82  /* GLOBUS_GRAM_JOB_MANAGER_STATE_PROXY_REFRESH OBSOLETE STATE, */
83  GLOBUS_GRAM_JOB_MANAGER_STATE_PRE_CLOSE_OUTPUT = GLOBUS_GRAM_JOB_MANAGER_STATE_POLL_QUERY2+2,
84  GLOBUS_GRAM_JOB_MANAGER_STATE_TWO_PHASE_QUERY1,
85  GLOBUS_GRAM_JOB_MANAGER_STATE_TWO_PHASE_QUERY2
86  /* GLOBUS_GRAM_JOB_MANAGER_STATE_TWO_PHASE_PROXY_REFRESH OBSOLETE STATE */
87 }
88 globus_gram_jobmanager_state_t;
89 
90 typedef enum
91 {
92  GLOBUS_GRAM_JOB_MANAGER_STAGE_IN,
93  GLOBUS_GRAM_JOB_MANAGER_STAGE_IN_SHARED,
94  GLOBUS_GRAM_JOB_MANAGER_STAGE_OUT,
95  GLOBUS_GRAM_JOB_MANAGER_STAGE_STREAMS
96 }
97 globus_gram_job_manager_staging_type_t;
98 
99 typedef enum
100 {
101  GLOBUS_GRAM_JOB_MANAGER_SIGNAL,
102  GLOBUS_GRAM_JOB_MANAGER_CANCEL,
103  GLOBUS_GRAM_JOB_MANAGER_PROXY_REFRESH
104 }
105 globus_gram_job_manager_query_type_t;
106 
107 typedef enum
108 {
109  GLOBUS_GRAM_SCRIPT_PRIORITY_LEVEL_CANCEL,
110  GLOBUS_GRAM_SCRIPT_PRIORITY_LEVEL_SIGNAL,
111  GLOBUS_GRAM_SCRIPT_PRIORITY_LEVEL_SUBMIT,
112  GLOBUS_GRAM_SCRIPT_PRIORITY_LEVEL_STAGE_OUT,
113  GLOBUS_GRAM_SCRIPT_PRIORITY_LEVEL_STAGE_IN,
114  GLOBUS_GRAM_SCRIPT_PRIORITY_LEVEL_POLL
115 }
116 globus_gram_script_priority_level_t;
117 
118 typedef struct
119 {
120  globus_gram_script_priority_level_t priority_level;
121  uint64_t sequence;
122 }
123 globus_gram_script_priority_t;
124 
125 typedef struct
126 {
127  globus_gram_job_manager_staging_type_t
128  type;
129  globus_rsl_value_t * from;
130  char * evaled_from;
131  globus_rsl_value_t * to;
132  char * evaled_to;
133 }
134 globus_gram_job_manager_staging_info_t;
135 
136 typedef struct
137 {
141  globus_gram_job_manager_query_type_t
142  type;
155 
162  char * signal_arg;
171  globus_rsl_t * rsl;
172 
173  globus_gram_protocol_error_t failure_code;
174 
175  /* When doing a proxy refresh, the newly delegated credential */
176  gss_cred_id_t delegated_credential;
177 }
178 globus_gram_job_manager_query_t;
179 
185 typedef struct
186 {
187  /*
188  * -------------------------------------------------------------------
189  * Values derived from command-line options and configuration file
190  * -------------------------------------------------------------------
191  */
195  globus_bool_t kerberos;
199  char * globus_location;
203  char * target_globus_location;
211  char * jobmanager_type;
215  char * job_history_dir;
219  char * cache_location;
228  char * scratch_dir_base;
235  char * condor_arch;
242  char * condor_os;
244  char * globus_gatekeeper_host;
246  char * globus_gatekeeper_port;
248  char * globus_gatekeeper_subject;
250  char * globus_host_manufacturer;
252  char * globus_host_cputype;
254  char * globus_host_osname;
256  char * globus_host_osversion;
261  char * tcp_port_range;
266  char * tcp_source_range;
268  char * job_state_file_dir;
272  char * x509_cert_dir;
278  globus_list_t * extra_envvars;
282  char * seg_module;
286  char * auditing_dir;
288  char * globus_version;
298  globus_bool_t streaming_disabled;
304  int proxy_timeout;
309  int log_levels;
313  globus_bool_t syslog_enabled;
317  const char * log_pattern;
318 
319  /*
320  * -------------------------------------------------------------------
321  * Values derived from job manager environment
322  * -------------------------------------------------------------------
323  */
325  char * subject;
327  char * home;
329  char * logname;
331  char * hostname;
333  char * short_hostname;
338  char * service_tag;
344  char * job_dir_home;
349  globus_bool_t enable_callout;
350 }
351 globus_gram_job_manager_config_t;
352 
353 typedef struct
354 {
355  globus_callback_handle_t session_timer_handle;
356  char * jm_id;
357  globus_abstime_t jm_start_time;
358 
359  int count_total_done;
360  int count_total_failed;
361  int count_total_canceled;
362  int count_restarted;
363  int count_dryrun;
364  int count_peak_jobs;
365  int count_current_jobs;
366 } globus_i_gram_usage_tracker_t;
367 
368 typedef struct globus_i_gram_usage_job_tracker_s
369 {
370  globus_abstime_t unsubmitted_timestamp;
371  globus_abstime_t file_stage_in_timestamp;
372  globus_abstime_t pending_timestamp;
373  globus_abstime_t active_timestamp;
374  globus_abstime_t failed_timestamp;
375  globus_abstime_t file_stage_out_timestamp;
376  globus_abstime_t done_timestamp;
377  int restart_count;
378  int callback_count;
379  int status_count;
380  int register_count;
381  int unregister_count;
382  int signal_count;
383  int refresh_count;
384  int file_clean_up_count;
385  int file_stage_in_http_count;
386  int file_stage_in_https_count;
387  int file_stage_in_ftp_count;
388  int file_stage_in_gsiftp_count;
389  int file_stage_in_shared_http_count;
390  int file_stage_in_shared_https_count;
391  int file_stage_in_shared_ftp_count;
392  int file_stage_in_shared_gsiftp_count;
393  int file_stage_out_http_count;
394  int file_stage_out_https_count;
395  int file_stage_out_ftp_count;
396  int file_stage_out_gsiftp_count;
397  char * client_address;
398  char * user_dn;
399 } globus_i_gram_usage_job_tracker_t;
400 
401 typedef struct
402 {
404  char * client_addr;
406  globus_priority_q_t script_queue;
408  int script_slots_available;
410  globus_fifo_t script_handles;
411 }
412 globus_gram_job_manager_scripts_t;
413 
419 typedef struct globus_gram_job_manager_s
420 {
422  globus_gram_job_manager_config_t * config;
426  globus_bool_t seg_started;
427 
432  time_t seg_last_timestamp;
436  globus_callback_handle_t fork_callback_handle;
438  globus_list_t * validation_records;
440  time_t validation_record_timestamp;
442  globus_bool_t validation_file_exists[4];
444  char * url_base;
446  time_t cred_expiration_time;
450  globus_callback_handle_t proxy_expiration_timer;
452  globus_hashtable_t request_hash;
454  globus_hashtable_t job_id_hash;
456  globus_mutex_t mutex;
458  globus_cond_t cond;
461  int socket_fd;
463  globus_xio_handle_t active_job_manager_handle;
465  int lock_fd;
467  char * socket_path;
469  char * lock_path;
471  char * pid_path;
477  globus_list_t * scripts_per_client;
479  globus_fifo_t state_callback_fifo;
481  int state_callback_slots;
483  char * cred_path;
485  globus_callback_handle_t grace_period_timer;
487  globus_bool_t done;
488  globus_fifo_t seg_event_queue;
489  int seg_pause_count;
491  globus_bool_t stop;
493  globus_list_t * pending_restarts;
495  globus_callback_handle_t pending_restart_handle;
497  globus_i_gram_usage_tracker_t * usagetracker;
502  char * gt3_failure_message;
503  globus_xio_attr_t script_attr;
504 
509  globus_callback_handle_t expiration_handle;
510 
514  globus_callback_handle_t lockcheck_handle;
515 
519  globus_callback_handle_t idle_script_handle;
520 }
521 globus_gram_job_manager_t;
522 
526 typedef struct globus_gram_job_manager_request_s
527 {
529  globus_gram_job_manager_config_t * config;
531  globus_gram_job_manager_t * manager;
542 
550  globus_gram_protocol_job_state_t expected_terminal_state;
551 
558  time_t status_update_time;
559 
567  int failure_code;
568 
572  char * gt3_failure_message;
573 
577  char * gt3_failure_type;
578 
582  char * gt3_failure_source;
583 
587  char * gt3_failure_destination;
588 
595  int exit_code;
596 
603  int stop_reason;
604 
612  char * job_id_string;
620  char * original_job_id_string;
621 
627  unsigned int poll_frequency;
628 
635  globus_bool_t dry_run;
636 
637 
646  int two_phase_commit;
647 
652  int commit_extend;
654  time_t creation_time;
656  time_t queued_time;
658  char * cache_tag;
660  globus_symboltable_t symbol_table;
662  globus_rsl_t * rsl;
664  char * rsl_spec;
671  char * jm_restart;
678  char * uniq_id;
680  char * job_contact;
682  char * job_contact_path;
684  char * job_state_file;
686  char * scratch_dir_base;
693  char * scratchdir;
695  char * remote_io_url;
697  char * remote_io_url_file;
699  char * x509_user_proxy;
701  globus_mutex_t mutex;
703  globus_cond_t cond;
705  globus_list_t * client_contacts;
707  globus_list_t * stage_in_todo;
709  globus_list_t * stage_in_shared_todo;
711  globus_list_t * stage_out_todo;
713  globus_list_t * stage_stream_todo;
715  globus_gram_jobmanager_state_t jobmanager_state;
717  globus_gram_jobmanager_state_t restart_state;
722  globus_bool_t unsent_status_change;
724  globus_callback_handle_t poll_timer;
729  globus_fifo_t pending_queries;
731  char * job_dir;
736  globus_bool_t streaming_requested;
738  char * cache_location;
740  globus_gass_cache_t cache_handle;
742  char * job_history_file;
744  int job_history_status;
748  char * cached_stdout;
752  char * cached_stderr;
754  gss_ctx_id_t response_context;
756  char * old_job_contact;
760  globus_fifo_t seg_event_queue;
765  time_t seg_last_timestamp;
769  char * gateway_user;
773  globus_i_gram_usage_job_tracker_t job_stats;
774 
779  int job_log_level;
783  char * log_pattern;
784 }
785 globus_gram_jobmanager_request_t;
786 
787 typedef struct globus_gram_job_manager_ref_s
788 {
789  /* Local copy of the unique hashtable key */
790  char * key;
791  /* Pointer to manager */
792  globus_gram_job_manager_t * manager;
793  /* Pointer to the request, may be NULL if the request is swapped out of
794  * memory because there is no active reference to it
795  */
796  globus_gram_jobmanager_request_t * request;
797  /* Count of callbacks, queries, etc that refer to this job.
798  * When 0, the request is eligible for removal from memory.
799  */
800  int reference_count;
801  /* Timer to delay cleaning up unreferenced requests */
802  globus_callback_handle_t cleanup_timer;
803  /* Current job state, for status updates without having to reload */
805  /* Current job failure code, for status updates without having to reload */
806  int failure_code;
807  /* Job exit code */
808  int exit_code;
809  /* Number of times status query was processed while the job is swapped
810  * out
811  */
812  int status_count;
813  /*
814  * True if the job has been loaded from the state file at recovery
815  * time, but hasn't yet had its state machine started. In that case,
816  * we have to go to the TWO_PHASE_COMMITTED state unless the job has
817  * completed execution.
818  */
819  globus_bool_t loaded_only;
820 
827  time_t expiration_time;
828 
829  /* The following are used for the internal fakeseg stuff for condor*/
830 
835  time_t seg_last_timestamp;
839  globus_off_t seg_last_size;
840 }
841 globus_gram_job_manager_ref_t;
842 
843 /* globus_gram_job_manager_config.c */
844 int
845 globus_gram_job_manager_config_init(
846  globus_gram_job_manager_config_t * config,
847  int argc,
848  char ** argv);
849 
850 void
851 globus_gram_job_manager_config_destroy(
852  globus_gram_job_manager_config_t * config);
853 
854 int
855 globus_i_gram_parse_log_levels(
856  const char * unparsed_string,
857  int * log_levels,
858  char ** error_string);
859 
860 /* globus_gram_job_manager_request.c */
861 #ifdef DEBUG_THREADS
862 #define GlobusGramJobManagerRequestLock(request) \
863  do { \
864  globus_gram_job_manager_request_log( \
865  request, \
866  "JM: [tid=%ld] Locking request (%s:%d) %p\n", \
867  (long) globus_thread_self(), \
868  __FILE__, \
869  __LINE__, \
870  (request)); \
871  globus_mutex_lock(&(request)->mutex); \
872  } while (0)
873 
874 #define GlobusGramJobManagerRequestUnlock(request) \
875  do { \
876  globus_gram_job_manager_request_log( \
877  request, \
878  "JM: [tid=%ld] Unlocking request (%s:%d) %p\n", \
879  (long) globus_thread_self() \
880  __FILE__, \
881  __LINE__, \
882  (request)); \
883  globus_mutex_unlock(&(request)->mutex); \
884  } while (0)
885 #else
886 #define GlobusGramJobManagerRequestLock(request) \
887  globus_mutex_lock(&(request)->mutex)
888 #define GlobusGramJobManagerRequestUnlock(request) \
889  globus_mutex_unlock(&(request)->mutex)
890 #endif
891 
892 int
893 globus_gram_job_manager_request_init(
894  globus_gram_jobmanager_request_t ** request,
895  globus_gram_job_manager_t * manager,
896  char * rsl,
897  gss_cred_id_t delegated_credential,
898  gss_ctx_id_t response_ctx,
899  const char * peer_address,
900  globus_gsi_cred_handle_t peer_cred,
901  globus_bool_t reinit,
902  char ** old_job_contact,
903  globus_gram_jobmanager_request_t ** old_job_request,
904  char ** gt3_failure_message);
905 
906 void
907 globus_gram_job_manager_request_destroy(
908  globus_gram_jobmanager_request_t * request);
909 
910 void
911 globus_gram_job_manager_request_free(
912  globus_gram_jobmanager_request_t * request);
913 
914 int
915 globus_gram_job_manager_request_set_status(
916  globus_gram_jobmanager_request_t * request,
918 
919 int
920 globus_gram_job_manager_request_set_status_time(
921  globus_gram_jobmanager_request_t * request,
923  time_t valid_time);
924 
925 void
926 globus_gram_job_manager_request_log(
927  globus_gram_jobmanager_request_t * request,
928  globus_gram_job_manager_log_level_t level,
929  const char * format,
930  ...);
931 
932 int
933 globus_gram_job_manager_request_acct(
934  globus_gram_jobmanager_request_t * request,
935  const char * format,
936  ...);
937 
938 int
939 globus_gram_job_manager_symbol_table_populate(
940  globus_gram_jobmanager_request_t * request);
941 
942 int
943 globus_gram_job_manager_history_file_set(
944  globus_gram_jobmanager_request_t * request);
945 
946 int
947 globus_gram_job_manager_history_file_create(
948  globus_gram_jobmanager_request_t * request);
949 
950 int
951 globus_gram_job_manager_request_load(
952  globus_gram_job_manager_t * manager,
953  int http_body_fd,
954  int context_fd,
955  gss_cred_id_t credential,
956  const char * peer_address,
957  globus_gsi_cred_handle_t peer_cred_handle,
958  size_t content_length,
959  globus_gram_jobmanager_request_t ** request,
960  gss_ctx_id_t * context,
961  char ** contact,
962  int * job_state_mask,
963  char ** old_job_contact,
964  globus_gram_jobmanager_request_t ** old_job_request,
965  globus_bool_t * version_only,
966  char ** gt3_failure_message);
967 
968 int
969 globus_gram_job_manager_request_start(
970  globus_gram_job_manager_t * manager,
971  globus_gram_jobmanager_request_t * request,
972  int response_fd,
973  const char * client_contact,
974  int job_state_mask);
975 
976 void
977 globus_gram_job_manager_destroy_directory(
978  globus_gram_jobmanager_request_t * request,
979  const char * directory);
980 
981 int
982 globus_gram_job_manager_request_load_all(
983  globus_gram_job_manager_t * manager);
984 
985 int
986 globus_i_gram_request_stdio_update(
987  globus_gram_jobmanager_request_t * request,
988  globus_rsl_t * update_rsl);
989 
990 int
991 globus_i_gram_symbol_table_populate(
992  globus_gram_job_manager_config_t * config,
993  globus_symboltable_t * symbol_table);
994 
995 /* globus_gram_job_manager_validate.c */
996 
1001 typedef enum
1002 {
1003  GLOBUS_GRAM_VALIDATE_JOB_SUBMIT = 1,
1004  GLOBUS_GRAM_VALIDATE_JOB_MANAGER_RESTART = 2,
1005  GLOBUS_GRAM_VALIDATE_STDIO_UPDATE = 4
1006 }
1007 globus_gram_job_manager_validation_when_t;
1008 
1009 extern
1010 int
1011 globus_gram_job_manager_validation_destroy(
1012  globus_list_t * validation_records);
1013 
1014 extern
1015 int
1016 globus_gram_job_manager_validate_rsl(
1017  globus_gram_jobmanager_request_t * request,
1018  globus_rsl_t * rsl,
1019  globus_gram_job_manager_validation_when_t
1020  when);
1021 
1022 /* globus_gram_job_manager_contact.c */
1023 int
1024 globus_gram_job_manager_contact_add(
1025  globus_gram_jobmanager_request_t * request,
1026  const char * contact,
1027  int job_state_mask);
1028 
1029 int
1030 globus_gram_job_manager_contact_remove(
1031  globus_gram_jobmanager_request_t * request,
1032  const char * contact);
1033 int
1034 globus_gram_job_manager_contact_list_free(
1035  globus_gram_jobmanager_request_t * request);
1036 
1037 void
1038 globus_gram_job_manager_contact_state_callback(
1039  globus_gram_jobmanager_request_t * request,
1040  globus_bool_t restart_state_machine);
1041 
1042 int
1043 globus_gram_job_manager_write_callback_contacts(
1044  globus_gram_jobmanager_request_t * request,
1045  FILE * fp);
1046 
1047 int
1048 globus_gram_job_manager_read_callback_contacts(
1049  globus_gram_jobmanager_request_t * request,
1050  FILE * fp);
1051 
1052 /* globus_gram_job_manager_state.c */
1053 extern
1054 const char * globus_i_gram_job_manager_state_strings[];
1055 
1056 int
1057 globus_gram_job_manager_read_request(
1058  globus_gram_job_manager_t * manager,
1059  int fd,
1060  size_t content_length,
1061  char ** rsl,
1062  char ** client_contact,
1063  int * job_state_mask,
1064  globus_bool_t * version_only);
1065 
1066 int
1067 globus_gram_job_manager_reply(
1068  globus_gram_jobmanager_request_t * request,
1069  globus_gram_job_manager_t * manager,
1070  int response_code,
1071  const char * job_contact,
1072  int response_fd,
1073  gss_ctx_id_t response_context,
1074  const char * gt3_failure_message);
1075 
1076 int
1077 globus_gram_job_manager_validate_username(
1078  globus_gram_jobmanager_request_t * request);
1079 
1080 int
1081 globus_gram_job_manager_state_machine_register(
1082  globus_gram_job_manager_t * manager,
1083  globus_gram_jobmanager_request_t * request,
1084  globus_reltime_t * delay);
1085 
1086 int
1087 globus_i_gram_remote_io_url_update(
1088  globus_gram_jobmanager_request_t * request);
1089 
1090 void
1091 globus_gram_job_manager_state_machine_callback(
1092  void * user_arg);
1093 
1094 /* globus_gram_job_manager_gsi.c */
1095 int
1096 globus_gram_job_manager_import_sec_context(
1097  globus_gram_job_manager_t * manager,
1098  int context_fd,
1099  gss_ctx_id_t * response_contextp);
1100 
1102 globus_gram_job_manager_gsi_used(
1103  globus_gram_jobmanager_request_t * request);
1104 
1105 int
1106 globus_gram_job_manager_gsi_register_proxy_timeout(
1107  globus_gram_job_manager_t * manager,
1108  gss_cred_id_t cred,
1109  int timeout,
1110  globus_callback_handle_t * callback_handle);
1111 
1112 int
1113 globus_gram_job_manager_gsi_get_subject(
1114  char ** subject_name);
1115 
1116 int
1117 globus_gram_job_manager_gsi_update_credential(
1118  globus_gram_job_manager_t * manager,
1119  globus_gram_jobmanager_request_t * request,
1120  gss_cred_id_t credential);
1121 
1122 int
1123 globus_gram_job_manager_gsi_write_credential(
1124  globus_gram_jobmanager_request_t * request,
1125  gss_cred_id_t credential,
1126  const char * path);
1127 
1128 int
1129 globus_gram_job_manager_gsi_update_proxy_timeout(
1130  globus_gram_job_manager_t * manager,
1131  gss_cred_id_t cred,
1132  int timeout,
1133  globus_callback_handle_t * callback_handle);
1134 
1135 int
1136 globus_gram_job_manager_gsi_relocate_proxy(
1137  globus_gram_jobmanager_request_t * request,
1138  const char * new_proxy);
1139 
1140 int
1141 globus_gram_job_manager_call_authz_callout(
1142  globus_gram_job_manager_config_t * config,
1143  gss_ctx_id_t request_context,
1144  gss_ctx_id_t authz_context,
1145  const char * uniq_id,
1146  const globus_rsl_t * rsl,
1147  const char * auth_type);
1148 
1149 int
1150 globus_gram_job_manager_authz_query(
1151  globus_gram_job_manager_t * manager,
1153  const char * uri,
1154  const char * auth_type);
1155 
1156 int
1157 globus_gram_gsi_get_dn_hash(
1158  gss_cred_id_t cred,
1159  unsigned long * hash);
1160 
1161 /* globus_gram_job_manager_query.c */
1162 void
1163 globus_gram_job_manager_query_callback(
1164  void * arg,
1166  globus_byte_t * buf,
1167  globus_size_t nbytes,
1168  int errorcode,
1169  char * uri);
1170 
1171 void
1172 globus_gram_job_manager_query_reply(
1173  globus_gram_jobmanager_request_t * request,
1174  globus_gram_job_manager_query_t * query);
1175 
1176 /* globus_gram_job_manager_staging.c */
1177 int
1178 globus_gram_job_manager_staging_create_list(
1179  globus_gram_jobmanager_request_t * request);
1180 
1181 int
1182 globus_gram_job_manager_streaming_list_replace(
1183  globus_gram_jobmanager_request_t * request);
1184 int
1185 globus_gram_job_manager_staging_remove(
1186  globus_gram_jobmanager_request_t * request,
1187  globus_gram_job_manager_staging_type_t
1188  type,
1189  char * from,
1190  char * to);
1191 
1192 int
1193 globus_gram_job_manager_staging_write_state(
1194  globus_gram_jobmanager_request_t * request,
1195  FILE * fp);
1196 int
1197 globus_gram_job_manager_staging_read_state(
1198  globus_gram_jobmanager_request_t * request,
1199  FILE * fp);
1200 
1201 void
1202 globus_gram_job_manager_staging_free_all(
1203  globus_gram_jobmanager_request_t * request);
1204 
1205 /* globus_gram_job_manager_rsl.c */
1206 globus_rsl_t *
1208  globus_rsl_t * base_rsl,
1209  globus_rsl_t * override_rsl);
1210 
1213  globus_rsl_t * rsl,
1214  const char * attribute);
1215 
1217 globus_gram_job_manager_rsl_need_stage_in(
1218  globus_gram_jobmanager_request_t * request);
1219 
1221 globus_gram_job_manager_rsl_need_stage_out(
1222  globus_gram_jobmanager_request_t * request);
1223 
1225 globus_gram_job_manager_rsl_need_file_cleanup(
1226  globus_gram_jobmanager_request_t * request);
1227 
1229 globus_gram_job_manager_rsl_need_scratchdir(
1230  globus_gram_jobmanager_request_t * request);
1231 
1233 globus_gram_job_manager_rsl_need_restart(
1234  globus_gram_jobmanager_request_t * request);
1235 
1236 int
1238  globus_rsl_t * ast_node,
1239  const char * var,
1240  const char * value);
1241 
1242 int
1244  globus_gram_jobmanager_request_t * request,
1245  char * attribute,
1246  char ** value);
1247 
1248 int
1250  globus_rsl_t * rsl,
1251  char * attribute);
1252 
1253 globus_rsl_t *
1254 globus_gram_job_manager_rsl_extract_relation(
1255  globus_rsl_t * rsl,
1256  const char * attribute);
1257 
1258 int
1259 globus_gram_job_manager_rsl_add_relation(
1260  globus_rsl_t * rsl,
1261  globus_rsl_t * relation);
1262 
1263 int
1264 globus_gram_job_manager_rsl_parse_value(
1265  char * value_string,
1266  globus_rsl_value_t ** rsl_value);
1267 
1268 int
1269 globus_gram_job_manager_rsl_evaluate_value(
1270  globus_symboltable_t * symbol_table,
1271  globus_rsl_value_t * value,
1272  char ** value_string);
1273 
1274 int
1275 globus_gram_job_manager_rsl_eval_string(
1276  globus_symboltable_t * symbol_table,
1277  const char * string,
1278  char ** value_string);
1279 
1280 int
1282  globus_rsl_t * rsl,
1283  const char * attribute,
1284  const char ** value_ptr);
1285 
1286 int
1288  globus_rsl_t * rsl,
1289  const char * attribute,
1290  globus_bool_t * value_ptr);
1291 
1292 int
1294  globus_rsl_t * rsl,
1295  const char * attribute,
1296  int * value_ptr);
1297 
1298 int
1300  globus_gram_jobmanager_request_t * request,
1301  globus_rsl_t * rsl,
1302  const char * attribute,
1303  const char * value);
1304 
1305 int
1307  globus_gram_jobmanager_request_t * request,
1308  globus_rsl_t * rsl,
1309  const char * source,
1310  const char * destination);
1311 
1312 /* globus_gram_job_manager_state_file.c */
1313 int
1314 globus_gram_job_manager_state_file_set(
1315  globus_gram_jobmanager_request_t * request,
1316  char ** state_file);
1317 
1318 int
1319 globus_gram_job_manager_file_lock(
1320  int fd);
1321 
1322 int
1323 globus_gram_job_manager_state_file_read(
1324  globus_gram_jobmanager_request_t * request);
1325 int
1326 globus_gram_job_manager_state_file_write(
1327  globus_gram_jobmanager_request_t * request);
1328 
1329 int
1330 globus_gram_job_manager_state_file_register_update(
1331  globus_gram_jobmanager_request_t * request);
1332 
1333 /* globus_gram_job_manager_script.c */
1334 int
1335 globus_gram_job_manager_script_stage_in(
1336  globus_gram_jobmanager_request_t * request);
1337 int
1338 globus_gram_job_manager_script_stage_out(
1339  globus_gram_jobmanager_request_t * request);
1340 int
1341 globus_gram_job_manager_script_submit(
1342  globus_gram_jobmanager_request_t * request);
1343 int
1344 globus_gram_job_manager_script_poll(
1345  globus_gram_jobmanager_request_t * request);
1346 int
1347 globus_gram_job_manager_script_signal(
1348  globus_gram_jobmanager_request_t * request,
1349  globus_gram_job_manager_query_t * query);
1350 int
1351 globus_gram_job_manager_script_cancel(
1352  globus_gram_jobmanager_request_t * request,
1353  globus_gram_job_manager_query_t * query);
1354 
1356 globus_i_gram_job_manager_script_valid_state_change(
1357  globus_gram_jobmanager_request_t * request,
1359 
1360 void
1361 globus_gram_job_manager_script_close_all(
1362  globus_gram_job_manager_t * manager);
1363 
1364 void
1365 globus_gram_script_close_idle(
1366  void * arg);
1367 
1368 extern globus_xio_driver_t globus_i_gram_job_manager_popen_driver;
1369 extern globus_xio_stack_t globus_i_gram_job_manager_popen_stack;
1370 
1371 /* globus_gram_job_manager_seg.c */
1373 globus_gram_job_manager_init_seg(
1374  globus_gram_job_manager_t * request);
1375 
1377 globus_gram_job_manager_shutdown_seg(
1378  globus_gram_job_manager_t * manager);
1379 
1380 void
1381 globus_gram_job_manager_seg_handle_event(
1382  globus_gram_jobmanager_request_t * request);
1383 
1384 void
1385 globus_gram_job_manager_seg_pause(
1386  globus_gram_job_manager_t * manager);
1387 
1388 void
1389 globus_gram_job_manager_seg_resume(
1390  globus_gram_job_manager_t * manager);
1391 
1392 int
1393 globus_gram_job_manager_seg_parse_condor_id(
1394  globus_gram_jobmanager_request_t * request,
1395  char ** condor_id);
1396 
1397 /* globus_gram_job_manager_auditing.c */
1398 int
1399 globus_gram_job_manager_auditing_file_write(
1400  globus_gram_jobmanager_request_t * request);
1401 
1402 /* globus_gram_job_manager.c */
1403 #ifdef DEBUG_THREADS
1404 #define GlobusGramJobManagerLock(manager) \
1405  do { \
1406  globus_gram_job_manager_log( \
1407  manager, \
1408  "JM: [tid=%ld] Locking manager (%s:%d) %p\n", \
1409  (long) globus_thread_self() \
1410  __FILE__, \
1411  __LINE__, \
1412  (manager)); \
1413  globus_mutex_lock(&(manager)->mutex); \
1414  } while (0)
1415 
1416 #define GlobusGramJobManagerUnlock(manager) \
1417  do { \
1418  globus_gram_job_manager_log( \
1419  manager, \
1420  "JM: [tid=%d] Unlocking manager (%s:%d) %p\n", \
1421  (long) globus_thread_self() \
1422  __FILE__, \
1423  __LINE__, \
1424  (manager)); \
1425  globus_mutex_unlock(&(manager)->mutex); \
1426  } while (0)
1427 #define GlobusGramJobManagerWait(manager) \
1428  do { \
1429  globus_gram_job_manager_log( \
1430  manager, \
1431  GLOBUS_GRAM_LOG_TRACE, \
1432  "JM: [tid=%ld] Condition Wait: Unlocking manager (%s:%d) %p\n", \
1433  (long) globus_thread_self() \
1434  __FILE__, \
1435  __LINE__, \
1436  (manager)); \
1437  globus_cond_wait(&(manager)->cond, &(manager)->mutex); \
1438  globus_gram_job_manager_log( \
1439  manager, \
1440  GLOBUS_GRAM_LOG_TRACE, \
1441  "JM: [tid=%ld] Condition Wait Returns: Locking manager (%s:%d) %p\n", \
1442  (long) globus_thread_self() \
1443  __FILE__, \
1444  __LINE__, \
1445  (manager)); \
1446  } while (0)
1447 #else
1448 #define GlobusGramJobManagerLock(manager) \
1449  globus_mutex_lock(&(manager)->mutex)
1450 #define GlobusGramJobManagerUnlock(manager) \
1451  globus_mutex_unlock(&(manager)->mutex)
1452 #define GlobusGramJobManagerWait(manager) \
1453  globus_cond_wait(&(manager)->cond, &(manager)->mutex);
1454 #endif
1455 int
1456 globus_gram_job_manager_init(
1457  globus_gram_job_manager_t * manager,
1458  gss_cred_id_t cred,
1459  globus_gram_job_manager_config_t * config);
1460 
1461 void
1462 globus_gram_job_manager_destroy(
1463  globus_gram_job_manager_t * manager);
1464 
1465 void
1466 globus_gram_job_manager_log(
1467  globus_gram_job_manager_t * manager,
1468  globus_gram_job_manager_log_level_t level,
1469  const char * format,
1470  ...);
1471 
1472 int
1473 globus_gram_job_manager_add_request(
1474  globus_gram_job_manager_t * manager,
1475  const char * key,
1476  globus_gram_jobmanager_request_t * request);
1477 
1478 int
1479 globus_gram_job_manager_add_reference(
1480  globus_gram_job_manager_t * manager,
1481  const char * key,
1482  const char * reason,
1483  globus_gram_jobmanager_request_t ** request);
1484 
1485 int
1486 globus_gram_job_manager_remove_reference(
1487  globus_gram_job_manager_t * manager,
1488  const char * reason,
1489  const char * key);
1490 
1491 int
1492 globus_gram_job_manager_register_job_id(
1493  globus_gram_job_manager_t * manager,
1494  char * job_id,
1495  globus_gram_jobmanager_request_t * request,
1496  globus_bool_t prelocked);
1497 
1498 int
1499 globus_gram_job_manager_unregister_job_id(
1500  globus_gram_job_manager_t * manager,
1501  char * job_id);
1502 
1503 int
1504 globus_gram_job_manager_add_reference_by_jobid(
1505  globus_gram_job_manager_t * manager,
1506  const char * jobid,
1507  const char * reason,
1508  globus_gram_jobmanager_request_t ** request);
1509 
1510 int
1511 globus_gram_job_manager_get_job_id_list(
1512  globus_gram_job_manager_t * manager,
1513  globus_list_t ** job_id_list);
1514 
1516 globus_gram_job_manager_request_exists(
1517  globus_gram_job_manager_t * manager,
1518  const char * key);
1519 
1520 void
1521 globus_gram_job_manager_set_grace_period_timer(
1522  globus_gram_job_manager_t * manager);
1523 
1524 void
1525 globus_gram_job_manager_expire_old_jobs(
1526  void * arg);
1527 
1528 int
1529 globus_gram_job_manager_set_status(
1530  globus_gram_job_manager_t * manager,
1531  const char * key,
1533  int failure_code,
1534  int exit_code);
1535 
1536 int
1537 globus_gram_job_manager_get_status(
1538  globus_gram_job_manager_t * manager,
1539  const char * key,
1541  int * failure_code,
1542  int * exit_code);
1543 
1544 void
1545 globus_gram_job_manager_stop_all_jobs(
1546  globus_gram_job_manager_t * manager);
1547 
1548 int
1549 globus_gram_split_subjobs(
1550  const char * job_id,
1551  globus_list_t ** subjobs);
1552 
1553 int
1554 globus_i_gram_mkdir(
1555  char * path);
1556 
1557 /* startup_socket.c */
1558 int
1559 globus_gram_job_manager_startup_lock(
1560  globus_gram_job_manager_t * manager,
1561  int * lock_fd);
1562 
1563 int
1564 globus_gram_job_manager_startup_socket_init(
1565  globus_gram_job_manager_t * manager,
1566  globus_xio_handle_t * handle,
1567  int * socket_fd);
1568 
1569 int
1570 globus_gram_job_manager_starter_send(
1571  globus_gram_job_manager_t * manager,
1572  int http_body_fd,
1573  int context_fd,
1574  int response_fd,
1575  gss_cred_id_t cred);
1576 
1577 int
1578 globus_gram_job_manager_starter_send_v2(
1579  globus_gram_job_manager_t * manager,
1580  gss_cred_id_t cred);
1581 
1582 extern globus_xio_driver_t globus_i_gram_job_manager_file_driver;
1583 extern globus_xio_stack_t globus_i_gram_job_manager_file_stack;
1584 
1585 /* tg_gateway.c */
1586 int
1587 globus_i_gram_get_tg_gateway_user(
1588  gss_ctx_id_t context,
1589  globus_gsi_cred_handle_t peer_cred,
1590  char ** gateway_user);
1591 
1592 
1593 /* logging.c */
1594 extern globus_logging_handle_t globus_i_gram_job_manager_log_stdio;
1595 extern globus_logging_handle_t globus_i_gram_job_manager_log_sys;
1596 
1597 extern
1598 void
1599 globus_i_job_manager_log_rotate(int sig);
1600 
1601 extern
1602 int
1603 globus_gram_job_manager_logging_init(
1604  globus_gram_job_manager_config_t * config);
1605 
1606 extern
1607 void
1608 globus_gram_job_manager_logging_destroy(void);
1609 
1610 extern
1611 char *
1612 globus_gram_prepare_log_string(
1613  const char * instr);
1614 
1615 extern char globus_i_gram_default_rvf[];
1616 
1617 #ifdef __cplusplus
1618 }
1619 #endif
1620 
1621 #endif /* GLOBUS_GRAM_JOB_MANAGER_INCLUDE */
1622 #endif /* ! GLOBUS_DONT_DOCUMENT_INTERNAL */
Globus GSI Credential Library.
int globus_gram_job_manager_rsl_attribute_get_boolean_value(globus_rsl_t *rsl, const char *attribute, globus_bool_t *value_ptr)
Definition: globus_gram_job_manager_rsl.c:1141
int globus_gram_rsl_add_output(globus_gram_jobmanager_request_t *request, globus_rsl_t *rsl, const char *attribute, const char *value)
Add an output attribute to an RSL.
Definition: globus_gram_job_manager_rsl.c:351
globus_gram_protocol_error_t
Definition: globus_gram_protocol_constants.h:25
int globus_bool_t
Boolean type.
Definition: globus_types.h:93
struct globus_i_gass_cache_t * globus_gass_cache_t
GASS Cache Handle.
Definition: globus_gass_cache.h:85
int globus_callback_handle_t
Periodic callback handle.
Definition: globus_callback.h:102
struct globus_fifo_s * globus_fifo_t
Definition: globus_fifo.h:48
struct globus_l_gsi_cred_handle_s * globus_gsi_cred_handle_t
Definition: globus_gsi_credential.h:162
globus_gram_protocol_job_signal_t
Definition: globus_gram_protocol_constants.h:212
unsigned long globus_gram_protocol_handle_t
Unique GRAM protocol identifier.
Definition: globus_gram_protocol.h:73
int globus_gram_job_manager_rsl_remove_attribute(globus_rsl_t *rsl, char *attribute)
Remove an RSL attribute.
Definition: globus_gram_job_manager_rsl.c:782
GASS Cache API.
List data type.
Definition: globus_list.h:44
int globus_gram_job_manager_rsl_attribute_get_string_value(globus_rsl_t *rsl, const char *attribute, const char **value_ptr)
Definition: globus_gram_job_manager_rsl.c:1089
int globus_gram_job_manager_rsl_eval_one_attribute(globus_gram_jobmanager_request_t *request, char *attribute, char **value)
Definition: globus_gram_job_manager_rsl.c:830
globus_rsl_t * globus_gram_job_manager_rsl_merge(globus_rsl_t *base_rsl, globus_rsl_t *override_rsl)
Merge two sets of RSL relations.
Definition: globus_gram_job_manager_rsl.c:52
Mutex.
Definition: globus_thread.h:107
Condition variable.
Definition: globus_thread.h:124
Globus RSL Parsing.
size_t globus_size_t
Standard size of memory objectThe globus_size_t is the size of a memory object. It is identical to si...
Definition: globus_types.h:48
unsigned char globus_byte_t
Unsigned byte datatypeThis is used for byte-addressable arrays of arbitrary data which is not subject...
Definition: globus_types.h:85
Thread-specific data key.
Definition: globus_thread.h:201
Headers common to all of Globus.
uint32_t globus_result_t
Definition: globus_types.h:99
int globus_gram_job_manager_rsl_env_add(globus_rsl_t *ast_node, const char *var, const char *value)
Add an environment variable to the job RSL.
Definition: globus_gram_job_manager_rsl.c:687
Priority Queue Structure.
Definition: globus_priority_q.h:98
int globus_gram_job_manager_rsl_attribute_get_int_value(globus_rsl_t *rsl, const char *attribute, int *value_ptr)
Definition: globus_gram_job_manager_rsl.c:1194
int globus_gram_rsl_add_stream_out(globus_gram_jobmanager_request_t *request, globus_rsl_t *rsl, const char *source, const char *destination)
Add a stage out value to the RSL.
Definition: globus_gram_job_manager_rsl.c:472
globus_gram_protocol_job_state_t
Definition: globus_gram_protocol_constants.h:270
GRAM Protocol API.
globus_bool_t globus_gram_job_manager_rsl_attribute_exists(globus_rsl_t *rsl, const char *attribute)
Attribute exists in an RSL.
Definition: globus_gram_job_manager_rsl.c:106