Commit Graph

58 Commits

Author SHA1 Message Date
David Anderson c29a4dac80 Fix a few compile warnings in client simulator.
Use snprintf() instead of sprintf() in a few places
(should eventually do it everywhere)

Notes:

(void)x;
seems to work (cross-platform) for suppressing unused arg warnings.

int n;
n = snprintf(buf, sizeof(buf), ....)
(void)n;

works in some cases for suppressing buffer-size warnings.
But not all cases.  Not sure why.
2023-03-22 17:09:43 -07:00
Vitalii Koshura 92a9b34e9c
[linux] Move all fcgi dependent stdio functions to the separate 'boinc_stdio.h' header only file
Signed-off-by: Vitalii Koshura <lestat.de.lionkur@gmail.com>
2023-02-12 19:50:22 +01:00
Vitalii Koshura 1ce3793c76
Remove unused BOINC_RCSID constants
This fixes #2953

Signed-off-by: Vitalii Koshura <lestat.de.lionkur@gmail.com>
2019-01-12 23:43:48 +02:00
David Anderson 3e4d86eed9 create_work(): use the SCHED_CONFIG passed as arg, not the global var 2017-12-22 19:59:38 -08:00
David Anderson 921dcd1498 remote job submission: don't error out if standard templates missing
If you specify the input or output templates,
the standard ones (appname_in, appname_out) don't need to exist.

Also, in create_work():
- don't read the output template; just check that it exists.
- deprecate the result_template_filepath arg; redundant
2017-09-18 16:13:14 -07:00
David Anderson 381e0caf14 Remote job submission: add support for per-job templates in submit requests
This supports the TACC use case,
in the jobs in a batch can use different Docker images
and different input and output file signatures,
none of which are known in advance.

Python API binding:
    - A JOB_DESC object can optionally contain wu_template and result_template
        elements, which are the templates (the actual XML) to use for that job.
        Add these to the XML request message if present.
    - Added the same capability to the PHP binding, but not C++.
    - Added and debugged test cases for both languages.

    Also, submit_batch() can take either a batch name (in which case
    the batch is created) or a batch ID
    (in which the batch was created prior to remotely staging files).

RPC handler:
    - in submit_batch(), check for jobs with templates specified
        and store them in files.
        For input templates (which are deleted after creating jobs)
        we put them in /tmp,
        and use a map so that if two templates are the same we use 1 file.
        For output templates (which have to last until all jobs are done)
        we put them in templates/tmp, with content-based filenames
        to economize.
    - When creating jobs, or generating SQL strings for multiple jobs,
        use these names as --wu_template_filename
        and --result_template_filename args to create_work
        (either cmdline args or stdin args)
    - Delete WU templates when done

create_work.cpp:
    handle per-job --wu_template and --result_template args in stdin job lines
    (the names of per-job WU and result templates).
    Maintain a map mapping WU template name to contents,
    to avoid repeatedly reading them.

    For jobs that don't specify templates, use the ones specified
    at the batch level, or the defaults.
2017-01-21 00:24:11 -08:00
David Anderson 2eabe3eab8 server: fix typo in result file name generation (from Keith) 2015-11-20 13:19:18 -08:00
David Anderson 6b81b0e63b server: provide access to output file names without random part
- add random substring as "_r123123"
- add function remove_random_from_filename() that removes
  the random substring from an output filename
2015-11-18 13:42:06 -08:00
Rom Walton f660d9dd62 Revert "server: Refine 153f660 so that it reverts back to the original behavior by default."
This reverts commit 3cecde776b.
2015-11-18 15:40:22 -05:00
Rom Walton 0a63f1b05c server: remove automatic assignment of the result.random field. Reverts back to previous behavior. 2015-11-18 13:49:43 -05:00
Rom Walton 3cecde776b server: Refine 153f660 so that it reverts back to the original behavior by default.
Introduce a new template macro <RANDFILE_*/>.  This will inject a random number into the result file names making them hard to guess.
2015-11-18 13:30:57 -05:00
David Anderson 153f6600d0 Server (assimilator): add random string to result file names
Otherwise, result file names can be inferred from result names.
An attacker with task A could find the name of the "wingman" task B,
upload fake files as B's output files,
upload the same files as A's output files,
report A as completed, and get unearned credit.
2015-11-16 19:28:30 -08:00
Christian Beer 1b5f48a8f8 use safe_strcpy to prevent buffer overflow
fixes CID 27894 found by Coverity
2015-10-22 15:02:20 +02:00
David Anderson 8cd8c8e7ee server software: handle 64-bit database IDs
The SETI@home result table is about to run out of 32-bit IDs,
so we need to move to 64-bit result IDs.
This will happen to the workunit table at some point too.

I changed the server C++ code to use the "long" type for all DB IDs
(and to use appropriate conversion codes like %lu).
"long" is 64 bit on 64-bit machines.
For uniformity I did this for all tables,
even ones (like app) that will never get big.

I chose NOT to change the DB schema for now.
The new code will work with 32-bit ID fields in the DB.
As projects approach the 32-bit limit on a table they can change
its ID field, and fields that reference this table, to BIGINT.
This is likely to happen only on the result and workunit tables.
I put functions in html/ops/db_update.php
to change the IDs of these tables.
2015-07-23 10:11:08 -07:00
David Anderson 558d76212f server: fix race condition when creating targeted jobs.
We were creating the workunit, then updating its transitioner_flags field.
If the transitioner runs inbetween,
it would (incorrectly) create results for the workunit.
Solution: set transitioner_flags during insert.
2014-06-02 19:01:44 -07:00
David Anderson 46d90b2b60 server: improve support for remote input files
A "remote input file" is located on a data server other than the project server.
Previously these could be specified only in the input template,
which was of limited utility.
Add new ways of specifying remote input files:
1) in the create_work program, a remote input file can be specified
  with command-line args
  --remote_file name URL nbytes MD5
  or by the same syntax in stdin when creating multiple jobs
2) add a variant of create_work() called create_work2(),
  which takes a vector of INFILE_DESC structures that can specify
  either local or remote files
2014-04-20 23:52:51 -07:00
David Anderson fec574f4e8 create_work: increase the efficiency of bulk job creation
The job submission RPC handler (PHP) originally ran the
create_work program once per job.
This took about 1.5 minutes to create 1000 jobs.
Recently I changed this so that create_work only is run once;
it does one SQL insert per job.
Disappointingly, this was only slightly faster: 1 min per 1000 jobs.

This commit changes create_work to create multiple jobs per SQL insert
(as many as will fit in a 1 MB query, which is the default limit).
This speeds things up by a factor of 100: 1000 jobs in 0.5 sec.
2014-04-10 23:53:19 -07:00
David Anderson ef82d5d9fb server: fix compile error on systems that don't define MAXPATHLEN 2013-08-22 17:01:45 -07:00
David Anderson b9f0733c06 server: replace strcpy() with strlcpy() various places 2013-06-03 22:42:53 -07:00
David Anderson 1a1a01c103 - server: initialize result.size_class and workunit.size_class to -1 2013-05-03 15:09:45 -07:00
David Anderson 0c430ce1fa Add support for multi-size apps
See http://boinc.berkeley.edu/trac/wiki/MultiSize
The components of this include:
- DB changes:
    add size_class to workunit and result
    n_size_classes to app; >1 means multi-size
- size_regulator daemon program: change results states
    from INACTIVE to UNSENT carefully
- size_census program; writes quantile info in flat files
- transitioner: when creating results for multi-size apps,
    set server state to INACTIVE
- sched shmem (feeder): read quantile info from flat files,
    store in shared memory
- scheduler (score-based scheduling): for multi-size apps,
    add component to score function for size class.
- show_shmem: show result size class
- make_work (and other callers of count_unsent_results()):
    count both INACTIVE and UNSENT
- create_work: add --size_class cmdline option

Also:
- if get MySQL errors in upgrade, don't rewrite db_version
2013-04-25 00:27:35 -07:00
David Anderson 48e1de5348 - remote job submission: bug fixes, and avoid divide by zero
in adjust_user_priority.  From Niclas Lockner.
2013-03-05 16:42:44 +01:00
David Anderson 3d60ae2508 - add PHP script for initializing user submit priorities
based on existing batches
2013-03-04 17:39:23 +01:00
David Anderson 6f962d5b61 - file upload handler: in FCGI version, check for trigger file
each time through loop (from Bernd).
- validator: fix bug that zeroed result.random
2013-03-04 17:24:18 +01:00
David Anderson 165e3bb1d5 - adjust_user_priority: scale FLOP count by app's min_avg_pfc
to account for systematic errors in FLOP count
- adjust_user_priority: get total project RAC by summing RAC
    of app versions where RAC has been updated in past week
- feeder: add --priority_asc option
    (for when wu.priority is a logical time)
2013-03-04 15:23:39 +01:00
David Anderson 2ded3ff67d - fix typo in GUI RPC
- check in some code for multi-user job prioritization
2013-03-04 15:23:39 +01:00
David Anderson 7cc750e616 - cancel_jobs tool: add --name option to cancel job by name.
From David Coss.


svn path=/trunk/boinc/; revision=26132
2012-09-20 18:28:29 +00:00
David Anderson 32a08d27d9 - C++ code: use MAXPATHLEN for char arrays that hold paths
svn path=/trunk/boinc/; revision=25659
2012-05-09 16:11:50 +00:00
David Anderson f12e82917f - back end: print error messages instead of numbers in several places
svn path=/trunk/boinc/; revision=25584
2012-04-20 17:23:07 +00:00
David Anderson ce52c9cf3e - storage stuff
svn path=/trunk/boinc/; revision=25341
2012-02-24 22:55:11 +00:00
David Anderson 1b8d6b098d - storage stuff (work in progress)
- small code shuffle


svn path=/trunk/boinc/; revision=25274
2012-02-16 23:59:26 +00:00
David Anderson 130d6ed4f0 - server: revamp the "assigned job" mechanism.
This now supports two main use cases:
    1) there's a job that you want to run once on all hosts,
        present and future
        (or all hosts belonging to a user, or to a team).
        The job is never transitioned, validated, or assimilated.
    2) There's a normal job for which you want to use only
        hosts belonging to a specific user (e.g. cluster or cloud hosts).
        This restriction can be made either when the job is created,
        or on the fly,
        e.g. as part of a scheme for accelerating batch completion.
        For the latter purposes we now provide a function
            restrict_wu_to_user(DB_WORKUNIT&, int userid);

        The job goes through the standard
        transitioner/validator/assimilator path.

    These cases are enabled by config flags
        <enable_assignment_multi/>
        <enable_assignment/>
    respectively.

    Assignment of type 2) are no longer stored in shared mem,
    so there is no limit on their number.

    There is no longer a rule that assigned job names must contain "asgn".

    NOTE: this requires a database update.


svn path=/trunk/boinc/; revision=25169
2012-01-30 22:39:13 +00:00
David Anderson 3410abef6f - backend API: added function cancel_jobs(minid, maxid)
for canceling jobs
- added program cancel_jobs for canceling jobs
- DB interface: it's not an error if update_fields_noid()
    affects != 1 rows


svn path=/trunk/boinc/; revision=24413
2011-10-18 07:15:04 +00:00
David Anderson c529c3c50d - server: rename process_wu_template() to process_input_template(),
and move it to its own file


svn path=/trunk/boinc/; revision=24107
2011-09-01 19:58:27 +00:00
David Anderson abdb603bc4 - job creation: handling of extra XML in input templates didn't work.
- job creation: fix stripping of <output_template> tags
- client: fix off-by-1 error in buffer overflow logic for scanning keys.


svn path=/trunk/boinc/; revision=24057
2011-08-27 16:52:04 +00:00
David Anderson 49205acfd9 - job submission: fix bug where parameters specified in the
input template (e.g., delay bound) were ignored
- web: fix PHP warning


svn path=/trunk/boinc/; revision=24039
2011-08-25 05:08:47 +00:00
David Anderson c5c5975b44 - Improve interface of XML_PARSER.
Add parsed_tag and is_tag to the class,
    so that parsing functions don't need to declare them
    and pass them around.
- Complete the task of using XML_PARSER as the argument
    to all parsing functions.
    (Internally, many of these functions still use the old XML parser;
    that's the next step.)


svn path=/trunk/boinc/; revision=23978
2011-08-10 17:11:08 +00:00
David Anderson dec057eaab - update_versions: fix bug where files not listed in version.xml
are not processed correctly
- remote job submission: debug
- create_work: --rsc_fpops_est etc. should override the template file


svn path=/trunk/boinc/; revision=23942
2011-08-07 04:32:02 +00:00
David Anderson 3c70004c5c - server: debug distributed storage functions
- generate upload signatures if needed
    - assign deadlines to file xfer jobs (default 1 week)
    - scheduler: ack completed file xfer results


svn path=/trunk/boinc/; revision=23866
2011-07-20 22:27:01 +00:00
David Anderson 27e05a3da9 - server: some stuff to prepare for distributed storage
- don't create result records for uploads and downloads.
        Just create a msg_to_client record.
    - the scheduler handles file-transfer results specially;
        it makes a vector of them, then calls a project-supplied function
        handle_file_xfer_results()
    - change the interface and implementation of put_file and get_file
- client write project sched priority in GUI RPC replies,
    but not to the state file


svn path=/trunk/boinc/; revision=23857
2011-07-19 20:52:41 +00:00
David Anderson bfc04f03eb - back end: fix bugs in [23648] which caused create_work
to mess up input templates containing
    <copy_file/> or other attribute tags.
    XML_PARSER now contains a member element() for when
    you want to copy an element without knowing its structure.


svn path=/trunk/boinc/; revision=23790
2011-07-04 23:51:00 +00:00
David Anderson 93add14614 - backend: use new XML parser for input template files
(so that they don't have to be 1 element/line)
    and also allow optional <input_template> root element
- fix bug in WORKUNIT DB interface


svn path=/trunk/boinc/; revision=23648
2011-06-07 04:12:49 +00:00
David Anderson 51c652640f - create_work: allow multiple URLs for non-local input files
(from Zoltan Farkas)
- scheduler: fix message describing per-app limits


svn path=/trunk/boinc/; revision=23546
2011-05-13 18:40:10 +00:00
David Anderson c70cd934b4 - server: rename send_file to put_file.
Factor out put_file() and get_file() functions
    so they have a C++ API as well as command-line


svn path=/trunk/boinc/; revision=23425
2011-04-24 02:00:27 +00:00
David Anderson 98b4c79e36 - client: if an app version has a missing GPU,
we still need to keep track of the usage
    and write it to the state file.
- get client simulator working again


svn path=/trunk/boinc/; revision=23413
2011-04-20 23:32:14 +00:00
David Anderson ded867aa25 - create_work and possibly other back-end programs:
fix bug that corrupted WU command lines.
    The problem: we were using strcpy(p, p+n) to delete the
    first n characters of p.
    This is incorrect - the behavior of strcpy() is undefined
    if its args overlap.
    On some systems (e.q. AQUA's server) it does wacky things.


svn path=/trunk/boinc/; revision=23007
2011-02-09 00:21:40 +00:00
David Anderson 91c251c103 - user web: add "delete account" feature.
This allows a user to delete all traces of themselves from a project.
    Namely:
    - clear fields of user record: email_addr, authenticator,
        name, country, postal_code
        Note: record is not deleted
    - clear the domain_name and last_ip_addr fields of hosts
        Note: records are not deleted
    - quit team
    - delete private messages sent and received
    - delete forum posts, subscriptions, and forum prefs
    - delete profile and associated images
- server: compile fix


svn path=/trunk/boinc/; revision=23006
2011-02-08 21:38:16 +00:00
David Anderson 8145cb86b0 - create_work: add some debugging printfs for Kamran
svn path=/trunk/boinc/; revision=22993
2011-02-03 23:27:30 +00:00
David Anderson 1e363ba46d - server (job submission): allow input templates to specify the
URL, size, and MD5 of input files.
    This supports "non-local" input files,
    i.e. files not present on the project server.

    NOTE: as implemented,
    this requires a separate input template for each job.
    It would be slightly better to let you specify the
    URL/size/MD5 in the create_work() call.

    From Zoltan Farkas (SZTAKI)
    

svn path=/trunk/boinc/; revision=22320
2010-09-07 20:18:58 +00:00
David Anderson bf56e80bce - tweaks
svn path=/trunk/boinc/; revision=22306
2010-08-29 08:43:40 +00:00