Skip to content

Commit

Permalink
Merge branch 'development' into development
Browse files Browse the repository at this point in the history
  • Loading branch information
baltzell authored Dec 10, 2024
2 parents 506e888 + a2711f3 commit 9abc31a
Show file tree
Hide file tree
Showing 99 changed files with 1,217 additions and 4,125 deletions.
25 changes: 25 additions & 0 deletions .containers/coatjava.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#syntax=docker/dockerfile:1

FROM ubuntu:noble

LABEL name="coatjava"
LABEL maintainer="Whitney Armstrong <[email protected]>"
LABEL architecture="amd64"

USER root


RUN apt update && apt upgrade -y
RUN apt install cmake vim maven groovy git ca-certificates wget curl python-is-python3 \
openjdk-17-jdk openjdk-17-jre openjdk-17-jdk-headless openjdk-17-jre-headless \
python3-sqlalchemy -y && update-ca-certificates

# CA certificates
ADD https://pki.jlab.org/JLabCA.crt /etc/ssl/certs/JLabCA.crt
#RUN trust anchor --store /image/JLabCA.crt

ARG REF_NAME=development
# build coatjava
RUN java --version && cd /opt && \
git clone https://code.jlab.org/hallb/alert/coatjava.git && cd coatjava && \
git fetch origin && git checkout ${REF_NAME} && ./build-coatjava.sh --nomaps
31 changes: 31 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
workflow:
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
- if: '$CI_PIPELINE_SOURCE == "web"'
- if: '$CI_PIPELINE_SOURCE == "webide"'
- if: '$CI_COMMIT_BRANCH == "master"'
- if: '$CI_COMMIT_BRANCH == "development"'
- if: '$CI_COMMIT_TAG'

default:
image: ubuntu:noble
retry: 2

coatjava_build:
image: gcr.io/kaniko-project/executor:debug
script:
- echo "${CI_COMMIT_REF_NAME}"
- >-
/kaniko/executor
--context $CI_PROJECT_DIR/docker
--dockerfile $CI_PROJECT_DIR/.containers/coatjava.Dockerfile
--destination $CI_REGISTRY_IMAGE/coatjava:${CI_COMMIT_REF_NAME}
--build-arg REF_NAME=${CI_COMMIT_REF_NAME}
alert_testing:
needs: ["coatjava_build"]
variables:
REF_NAME: "$CI_COMMIT_REF_NAME"
trigger:
project: hallb/alert/c12
strategy: depend
107 changes: 107 additions & 0 deletions bin/hipo-multi-merge
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
#!/usr/bin/env ruby

require 'optparse'
require 'ostruct'
require 'fileutils'

def print_log(name, val)
puts name.rjust(30) + " = #{val}"
end

# user options
@args = OpenStruct.new
@args.inputs = nil
@args.output_dir = nil
@args.prefix = nil
@args.num_merge = nil
@args.use_batch = false
@args.dry_run = false
OptionParser.new do |o|
o.banner = '''
This tool merges a set of input HIPO files to a set of output HIPO files,
where you may control the number of input files per output file; for example,
use this tool if you have 1000 small HIPO files but would rather have 10
large HIPO files.
'''
o.separator "USAGE: #{$0} [OPTIONS]..."
o.separator ''
o.separator 'REQUIRED OPTIONS:'
o.on('-i', '--input INPUTS', 'input directory or file glob;', 'surround file glob in quotes') { |a| @args.inputs = a }
o.on('-o', '--output OUTPUT_DIR', 'output directory') { |a| @args.output_dir = a }
o.on('-p', '--prefix OUTPUT_PREFIX', 'output filename prefix; names will be:', ' [OUTPUT_DIR]/[OUTPUT_PREFIX]_#####.hipo') { |a| @args.prefix = a }
o.on('-n', '--num NUM_FILES', 'number of files per output merged file') { |a| @args.num_merge = a.to_i }
o.separator ''
o.separator 'OPTIONAL OPTIONS:'
o.on('-b', '--batch', 'submit jobs to Slurm', '(default is sequential jobs)') { |a| @args.use_batch = true }
o.on('-d', '--dry-run', 'just print what would be done') { |a| @args.dry_run = true }
o.on_tail('-h', '--help', 'show this message') do
puts o
exit
end
end.parse! ARGV.empty? ? ['--help'] : ARGV

# check required options
if [@args.inputs, @args.output_dir, @args.prefix, @args.num_merge].include? nil
raise 'missing required option(s;) re-run with "--help" for guidance.'
end
raise 'option "--num" must be greater than zero' unless @args.num_merge > 0

# glob inputs
input_glob = File.expand_path @args.inputs
input_glob = File.join input_glob, "*.hipo" if File.directory? input_glob
print_log 'input glob', input_glob
print_log 'output dir', @args.output_dir
print_log 'output prefix', @args.prefix
print_log 'num files per output', @args.num_merge

# chunks
input_files = Dir.glob input_glob
raise "no input files found with glob '#{input_glob}'" if input_files.empty?
input_chunks = input_files.each_slice(@args.num_merge).to_a
print_log 'num input files', input_files.size
print_log 'num output files', input_chunks.size
raise 'option "--num" >= num input files, therefore there is nothing to do' if input_chunks.size == 1

# build commands
puts "="*82
merge_cmds = input_chunks.each_with_index.map do |input_chunk, chunk_num|
out_name = File.join @args.output_dir, "#{@args.prefix}_#{chunk_num.to_s.rjust(5, '0')}.hipo"
raise "output file #{out_name} already exists; cannot overwrite! delete it or choose another path/name" if File.exist? out_name
[ 'hipo-utils', '-merge', '-o', out_name, *input_chunk ].join ' '
end

# sbatch commands
if @args.use_batch
sbatch_args = {
'job-name' => "hipo_multi_merge___#{@args.prefix}",
'account' => 'clas12',
'partition' => 'production',
'mem-per-cpu' => 500,
'time' => '1:00:00',
'ntasks' => 1,
'cpus-per-task' => 1,
}.map{ |opt, val| "--#{opt}=#{val.to_s}" }
exe_cmds = merge_cmds.each_with_index.map do |merge_cmd, job_num|
log_name = "/farm_out/%u/%x_#{job_num.to_s.rjust(5, '0')}"
[
'sbatch',
*sbatch_args,
"--output=#{log_name}.out",
"--error=#{log_name}.err",
"--wrap='#{merge_cmd}'",
].join ' '
end
else
exe_cmds = merge_cmds
end

# execute
if @args.dry_run
puts 'THIS IS JUST A DRY RUN. Here are the commands which would be executed:'
puts "="*82
puts "mkdir -p #{@args.output_dir}"
exe_cmds.each do |cmd| puts cmd end
else
FileUtils.mkdir_p @args.output_dir
exe_cmds.each do |cmd| system cmd end
end
2 changes: 1 addition & 1 deletion bin/run-clara
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ do
p) prefix=$OPTARG ;;
c) CLARA_HOME=$OPTARG ;;
t) threads=$OPTARG && echo $threads | grep -q -E '^[0-9]+$' || error "-t must be an integer, threads" ;;
n) nevents="-e $OPTARG" && echo $nevents | grep -q -E '^-e [0-9]+$' || error "-n must be an integer, events" ;;
n) nevents="-e $OPTARG" && echo "$nevents" | grep -q -E '^-e [0-9]+$' || error "-n must be an integer, events" ;;
m) merge=1 ;;
h) echo -e "\n$usage" && echo -e $info && exit 0 ;;
esac
Expand Down
4 changes: 2 additions & 2 deletions common-tools/clara-io/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.jlab.clas</groupId>
<artifactId>clara-io</artifactId>
<version>11.0.3-SNAPSHOT</version>
<version>11.0.5-SNAPSHOT</version>
<packaging>jar</packaging>

<parent>
<groupId>org.jlab.clas</groupId>
<artifactId>clas12rec</artifactId>
<relativePath>../../parent/pom.xml</relativePath>
<version>11.0.3-SNAPSHOT</version>
<version>11.0.5-SNAPSHOT</version>
</parent>

<dependencies>
Expand Down
20 changes: 10 additions & 10 deletions common-tools/clas-analysis/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,63 +3,63 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.jlab.clas</groupId>
<artifactId>clas-analysis</artifactId>
<version>11.0.3-SNAPSHOT</version>
<version>11.0.5-SNAPSHOT</version>
<packaging>jar</packaging>

<parent>
<groupId>org.jlab.clas</groupId>
<artifactId>clas12rec</artifactId>
<relativePath>../../parent/pom.xml</relativePath>
<version>11.0.3-SNAPSHOT</version>
<version>11.0.5-SNAPSHOT</version>
</parent>

<dependencies>
<dependency>
<groupId>org.jlab.clas</groupId>
<artifactId>clas-utils</artifactId>
<version>11.0.3-SNAPSHOT</version>
<version>11.0.5-SNAPSHOT</version>
</dependency>

<dependency>
<groupId>org.jlab.clas</groupId>
<artifactId>clas-physics</artifactId>
<version>11.0.3-SNAPSHOT</version>
<version>11.0.5-SNAPSHOT</version>
</dependency>

<dependency>
<groupId>org.jlab.clas</groupId>
<artifactId>clas-io</artifactId>
<version>11.0.3-SNAPSHOT</version>
<version>11.0.5-SNAPSHOT</version>
</dependency>

<dependency>
<groupId>org.jlab.clas</groupId>
<artifactId>clas-geometry</artifactId>
<version>11.0.3-SNAPSHOT</version>
<version>11.0.5-SNAPSHOT</version>
</dependency>

<dependency>
<groupId>org.jlab.clas</groupId>
<artifactId>clas-jcsg</artifactId>
<version>11.0.3-SNAPSHOT</version>
<version>11.0.5-SNAPSHOT</version>
</dependency>

<dependency>
<groupId>org.jlab.clas</groupId>
<artifactId>swim-tools</artifactId>
<version>11.0.3-SNAPSHOT</version>
<version>11.0.5-SNAPSHOT</version>
</dependency>

<dependency>
<groupId>org.jlab.clas</groupId>
<artifactId>clas-detector</artifactId>
<version>11.0.3-SNAPSHOT</version>
<version>11.0.5-SNAPSHOT</version>
</dependency>

<dependency>
<groupId>org.jlab.clas</groupId>
<artifactId>clas-reco</artifactId>
<version>11.0.3-SNAPSHOT</version>
<version>11.0.5-SNAPSHOT</version>
</dependency>
</dependencies>

Expand Down
10 changes: 5 additions & 5 deletions common-tools/clas-detector/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.jlab.clas</groupId>
<artifactId>clas-detector</artifactId>
<version>11.0.3-SNAPSHOT</version>
<version>11.0.5-SNAPSHOT</version>
<packaging>jar</packaging>

<parent>
<groupId>org.jlab.clas</groupId>
<artifactId>clas12rec</artifactId>
<relativePath>../../parent/pom.xml</relativePath>
<version>11.0.3-SNAPSHOT</version>
<version>11.0.5-SNAPSHOT</version>
</parent>

<dependencies>
<dependency>
<groupId>org.jlab.clas</groupId>
<artifactId>clas-utils</artifactId>
<version>11.0.3-SNAPSHOT</version>
<version>11.0.5-SNAPSHOT</version>
</dependency>

<dependency>
Expand All @@ -29,13 +29,13 @@
<dependency>
<groupId>org.jlab.clas</groupId>
<artifactId>clas-io</artifactId>
<version>11.0.3-SNAPSHOT</version>
<version>11.0.5-SNAPSHOT</version>
</dependency>

<dependency>
<groupId>org.jlab.clas</groupId>
<artifactId>clas-geometry</artifactId>
<version>11.0.3-SNAPSHOT</version>
<version>11.0.5-SNAPSHOT</version>
</dependency>
</dependencies>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ public enum DetectorType {
BAND (21, "BAND"),
RASTER (22, "RASTER"),
URWELL (23, "URWELL"),
AHDC (24, "AHDC"),
ATOF (25, "ATOF"),
TARGET (100, "TARGET"),
MAGNETS (101, "MAGNETS"),
ECIN (110, "ECIN"),
Expand Down
Loading

0 comments on commit 9abc31a

Please sign in to comment.