355b4669e025ff377602b6fc7caaf30dbc218371jacobs * CDDL HEADER START
355b4669e025ff377602b6fc7caaf30dbc218371jacobs * The contents of this file are subject to the terms of the
355b4669e025ff377602b6fc7caaf30dbc218371jacobs * Common Development and Distribution License (the "License").
355b4669e025ff377602b6fc7caaf30dbc218371jacobs * You may not use this file except in compliance with the License.
355b4669e025ff377602b6fc7caaf30dbc218371jacobs * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
355b4669e025ff377602b6fc7caaf30dbc218371jacobs * See the License for the specific language governing permissions
355b4669e025ff377602b6fc7caaf30dbc218371jacobs * and limitations under the License.
355b4669e025ff377602b6fc7caaf30dbc218371jacobs * When distributing Covered Code, include this CDDL HEADER in each
355b4669e025ff377602b6fc7caaf30dbc218371jacobs * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
355b4669e025ff377602b6fc7caaf30dbc218371jacobs * If applicable, add the following below this CDDL HEADER, with the
355b4669e025ff377602b6fc7caaf30dbc218371jacobs * fields enclosed by brackets "[]" replaced with your own identifying
355b4669e025ff377602b6fc7caaf30dbc218371jacobs * information: Portions Copyright [yyyy] [name of copyright owner]
355b4669e025ff377602b6fc7caaf30dbc218371jacobs * CDDL HEADER END
edafac1f8203a7de1490688213c118b03215c89dKeerthi Kondaka * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
355b4669e025ff377602b6fc7caaf30dbc218371jacobs * Use is subject to license terms.
179184d3e9bc6ab146407a62a8461338687b1908jacobs/* $Id: job.c 179 2006-07-17 18:24:07Z njacobs $ */
355b4669e025ff377602b6fc7caaf30dbc218371jacobs * must copy files before leaving routine
355b4669e025ff377602b6fc7caaf30dbc218371jacobspapiJobSubmit(papi_service_t handle, char *name, papi_attribute_t **attributes,
355b4669e025ff377602b6fc7caaf30dbc218371jacobs papi_job_ticket_t *job_ticket, char **files, papi_job_t *job)
355b4669e025ff377602b6fc7caaf30dbc218371jacobs if ((svc == NULL) || (name == NULL) || (files == NULL) ||
54f1e6d0c65afabe949aadb54f842af6603508deceastha gettext("papiJobSubmit: job ticket not supported"));
355b4669e025ff377602b6fc7caaf30dbc218371jacobs if ((status = service_fill_in(svc, name)) != PAPI_OK)
355b4669e025ff377602b6fc7caaf30dbc218371jacobs if ((*job = j = (job_t *)calloc(1, sizeof (*j))) == NULL) {
e3ccc2c3c4b8b02e2eee9fd88d847ab967376b0bsonam gupta - Sun Microsystems - Bangalore India /* before creating a control file add the job-name */
e3ccc2c3c4b8b02e2eee9fd88d847ab967376b0bsonam gupta - Sun Microsystems - Bangalore India if ((files != NULL) && (files[0] != NULL))
e3ccc2c3c4b8b02e2eee9fd88d847ab967376b0bsonam gupta - Sun Microsystems - Bangalore India papiAttributeListAddString(&attributes, PAPI_ATTR_EXCL,
e3ccc2c3c4b8b02e2eee9fd88d847ab967376b0bsonam gupta - Sun Microsystems - Bangalore India "job-name", files[0]);
355b4669e025ff377602b6fc7caaf30dbc218371jacobs /* create a control file */
54f1e6d0c65afabe949aadb54f842af6603508deceastha (void) lpd_job_add_attributes(svc, attributes, &metadata,
54f1e6d0c65afabe949aadb54f842af6603508deceastha if ((status = lpd_job_add_files(svc, attributes, files, &metadata,
355b4669e025ff377602b6fc7caaf30dbc218371jacobs /* send the job to the server */
355b4669e025ff377602b6fc7caaf30dbc218371jacobs status = lpd_submit_job(svc, metadata, &j->attributes, NULL);
355b4669e025ff377602b6fc7caaf30dbc218371jacobspapiJobSubmitByReference(papi_service_t handle, char *name,
355b4669e025ff377602b6fc7caaf30dbc218371jacobs papi_job_ticket_t *job_ticket, char **files, papi_job_t *job)
355b4669e025ff377602b6fc7caaf30dbc218371jacobs papi_job_ticket_t *job_ticket, papi_stream_t *stream)
355b4669e025ff377602b6fc7caaf30dbc218371jacobs if ((svc == NULL) || (name == NULL) || (stream == NULL))
355b4669e025ff377602b6fc7caaf30dbc218371jacobs if ((status = service_fill_in(svc, name)) != PAPI_OK)
355b4669e025ff377602b6fc7caaf30dbc218371jacobs /* create the stream container */
355b4669e025ff377602b6fc7caaf30dbc218371jacobs /* create the job */
355b4669e025ff377602b6fc7caaf30dbc218371jacobs if ((s->job = calloc(1, sizeof (*(s->job)))) == NULL)
edafac1f8203a7de1490688213c118b03215c89dKeerthi Kondaka papiAttributeListAddString(&attributes, PAPI_ATTR_EXCL,
355b4669e025ff377602b6fc7caaf30dbc218371jacobs /* process the attribute list */
355b4669e025ff377602b6fc7caaf30dbc218371jacobs lpd_job_add_attributes(svc, attributes, &metadata, &s->job->attributes);
355b4669e025ff377602b6fc7caaf30dbc218371jacobs /* if we can stream, do it */
355b4669e025ff377602b6fc7caaf30dbc218371jacobs (strcasecmp(svc->uri->fragment, "streaming") == 0)) {
355b4669e025ff377602b6fc7caaf30dbc218371jacobs status = lpd_submit_job(svc, metadata, &(s->job->attributes),
37c30c18a30adf1c89f3e563208e93e6c7501dedKeerthi Kondaka papiAttributeListToString(attributes, " ", buf, sizeof (buf));
37c30c18a30adf1c89f3e563208e93e6c7501dedKeerthi Kondaka papiAttributeListFromString(&(s->job->attributes),
355b4669e025ff377602b6fc7caaf30dbc218371jacobspapiJobStreamWrite(papi_service_t handle, papi_stream_t stream,
355b4669e025ff377602b6fc7caaf30dbc218371jacobs if ((svc == NULL) || (stream == NULL) || (buffer == NULL) ||
355b4669e025ff377602b6fc7caaf30dbc218371jacobspapiJobStreamClose(papi_service_t handle, papi_stream_t stream, papi_job_t *job)
355b4669e025ff377602b6fc7caaf30dbc218371jacobs if ((svc == NULL) || (stream == NULL) || (job == NULL))
355b4669e025ff377602b6fc7caaf30dbc218371jacobs if (s->dfname != NULL) { /* if it is a tmpfile, print it */
355b4669e025ff377602b6fc7caaf30dbc218371jacobs lpd_job_add_files(svc, s->job->attributes, files, &s->metadata,
355b4669e025ff377602b6fc7caaf30dbc218371jacobspapiJobQuery(papi_service_t handle, char *name, int32_t job_id,
355b4669e025ff377602b6fc7caaf30dbc218371jacobs if ((status = service_fill_in(svc, name)) == PAPI_OK)
355b4669e025ff377602b6fc7caaf30dbc218371jacobs status = lpd_find_job_info(svc, job_id, (job_t **)job);
355b4669e025ff377602b6fc7caaf30dbc218371jacobspapiJobCancel(papi_service_t handle, char *name, int32_t job_id)
355b4669e025ff377602b6fc7caaf30dbc218371jacobs if ((status = service_fill_in(svc, name)) == PAPI_OK)
355b4669e025ff377602b6fc7caaf30dbc218371jacobs if (j != NULL) {