workflow_manager 0.5.5 → 0.5.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c6828da4a43654aa14bb9a4592a42bdc3d0084daf98e7ab29cb11d94928b54de
4
- data.tar.gz: 87122a9b3e395f12535e700d80568328876f8784917da762956d7abbdd4a77c0
3
+ metadata.gz: 624dc0f37286ee8b893ceb0d73cce4ce83ab6078be6b1f06a96c316e145311f4
4
+ data.tar.gz: 805777d8e45242281c3e929b03a92d3fd9205c6c091f716ebb16b93bf15904e9
5
5
  SHA512:
6
- metadata.gz: a27da5bd02d7d6a8130f9bb8844c3b4a640153a37751e0e7bd34fd64d0c13caaf0e0aade85e34ec4699a3307fe8df6624562e9a0cd48858861ec543bd3c1c910
7
- data.tar.gz: 6f043fe95d6911baffbd0f606f5790d60651a013cea213caf1728632267987f09a20e161ea186f372eaaf66f7823f07e323990268bdc28ec669f37623f02b409
6
+ metadata.gz: 8c89da95c15863910c397bc149b799b094ee631feb092a7e0ffea7648c2148e09677b1288bf41daa5aa798b8a315ad3e7d2a4686d2b7bb5ced4f57fe8eff2161
7
+ data.tar.gz: bea9060c0b8322b3b096ffdae4ac82d9f523bc9322b8bfa412f986aab5c56881523985698c974eb581560929eea60d34189724efae29c28e31127512f0b56478
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
  # encoding: utf-8
3
3
  # 20121112 masa workflow manager client
4
- Version = '20130517-111334'
4
+ Version = '20200522-134606'
5
5
 
6
6
  require 'drb/drb'
7
7
 
@@ -28,3 +28,4 @@ if wfmrc
28
28
  end
29
29
  workflow_manager = DRbObject.new_with_uri(uri)
30
30
  puts workflow_manager.hello
31
+ puts workflow_manager.cluster_node_list
@@ -358,10 +358,11 @@ module WorkflowManager
358
358
  new_job_script_base = File.basename(new_job_script)
359
359
  log_file = File.join(@log_dir, new_job_script_base + "_o.log")
360
360
  err_file = File.join(@log_dir, new_job_script_base + "_e.log")
361
- #command = "g-sub -o #{log_file} -e #{err_file} #{option} #{new_job_script}"
362
- command = "sbatch -o #{log_file} -e #{err_file} #{option} #{new_job_script}"
361
+ command = "g-sub -o #{log_file} -e #{err_file} -q course #{option} #{new_job_script}"
362
+ #command = "sbatch -o #{log_file} -e #{err_file} #{new_job_script}"
363
363
  job_id = `#{command}`
364
- job_id = job_id.match(/Your job (\d+) \(/)[1]
364
+ #job_id = job_id.match(/Your job (\d+) \(/)[1]
365
+ job_id = job_id.chomp.split.last
365
366
  [job_id, log_file, command]
366
367
  else
367
368
  err_msg = "FGCZDevian10Cluster#submit_job, ERROR: script_name is not *.sh: #{File.basename(script_file)}"
@@ -432,4 +433,96 @@ module WorkflowManager
432
433
  }
433
434
  end
434
435
  end
436
+
437
+ class FGCZDebian10CourseCluster < Cluster
438
+ def submit_job(script_file, script_content, option='')
439
+ if script_name = File.basename(script_file) and script_name =~ /\.sh/
440
+ script_name = script_name.split(/\.sh/).first + ".sh"
441
+ new_job_script = generate_new_job_script(script_name, script_content)
442
+ new_job_script_base = File.basename(new_job_script)
443
+ log_file = File.join(@log_dir, new_job_script_base + "_o.log")
444
+ err_file = File.join(@log_dir, new_job_script_base + "_e.log")
445
+ command = "g-sub -o #{log_file} -e #{err_file} -q course #{option} #{new_job_script}"
446
+ job_id = `#{command}`
447
+ job_id = job_id.chomp.split.last
448
+ [job_id, log_file, command]
449
+ else
450
+ err_msg = "FGCZDebian10CourseCluster#submit_job, ERROR: script_name is not *.sh: #{File.basename(script_file)}"
451
+ warn err_msg
452
+ raise err_msg
453
+ end
454
+ end
455
+ def job_running?(job_id)
456
+ qstat_flag = false
457
+ IO.popen('squeue') do |io|
458
+ while line=io.gets
459
+ # ["JOBID", "PARTITION", "NAME", "USER", "ST", "TIME", "NODES", "NODELIST(REASON)"]
460
+ # ["206", "employee", "test.sh", "masaomi", "R", "0:03", "1", "fgcz-h-030"]
461
+ jobid, partition, name, user, state, *others = line.chomp.split
462
+ if jobid.strip == job_id and state == 'R'
463
+ qstat_flag = true
464
+ break
465
+ end
466
+ end
467
+ end
468
+ qstat_flag
469
+ end
470
+ def job_ends?(log_file)
471
+ log_flag = false
472
+ IO.popen("tail -n 10 #{log_file} 2> /dev/null") do |io|
473
+ while line=io.gets
474
+ if line =~ /__SCRIPT END__/
475
+ log_flag = true
476
+ break
477
+ end
478
+ end
479
+ end
480
+ log_flag
481
+ end
482
+ def job_pending?(job_id)
483
+ qstat_flag = false
484
+ IO.popen('squeue') do |io|
485
+ while line=io.gets
486
+ jobid, partition, name, user, state, *others = line.chomp.split
487
+ if jobid.strip == job_id and state =~ /PD/
488
+ qstat_flag = true
489
+ break
490
+ end
491
+ end
492
+ end
493
+ qstat_flag
494
+ end
495
+ def copy_commands(org_dir, dest_parent_dir, now=nil)
496
+ commands = ["cp -r #{org_dir} #{dest_parent_dir}"]
497
+ end
498
+ def kill_command(job_id)
499
+ command = "scancel #{job_id}"
500
+ end
501
+ def delete_command(target)
502
+ command = "rm -rf #{target}"
503
+ end
504
+ def cluster_nodes
505
+ nodes = {
506
+ 'fgcz-h-900: cpu 8,mem 30 GB,scr 500G' => 'fgcz-h-900',
507
+ 'fgcz-h-901: cpu 8,mem 30 GB,scr 500G' => 'fgcz-h-901',
508
+ 'fgcz-h-902: cpu 8,mem 30 GB,scr 500G' => 'fgcz-h-902',
509
+ 'fgcz-h-903: cpu 8,mem 30 GB,scr 500G' => 'fgcz-h-903',
510
+ 'fgcz-h-904: cpu 8,mem 30 GB,scr 500G' => 'fgcz-h-904',
511
+ 'fgcz-h-905: cpu 8,mem 30 GB,scr 500G' => 'fgcz-h-905',
512
+ 'fgcz-h-906: cpu 8,mem 30 GB,scr 500G' => 'fgcz-h-906',
513
+ 'fgcz-h-907: cpu 8,mem 30 GB,scr 500G' => 'fgcz-h-907',
514
+ 'fgcz-h-908: cpu 8,mem 30 GB,scr 500G' => 'fgcz-h-908',
515
+ 'fgcz-h-909: cpu 8,mem 30 GB,scr 500G' => 'fgcz-h-909',
516
+ 'fgcz-h-910: cpu 8,mem 30 GB,scr 500G' => 'fgcz-h-910',
517
+ 'fgcz-h-911: cpu 8,mem 30 GB,scr 500G' => 'fgcz-h-911',
518
+ 'fgcz-h-912: cpu 8,mem 30 GB,scr 500G' => 'fgcz-h-912',
519
+ 'fgcz-h-913: cpu 8,mem 30 GB,scr 500G' => 'fgcz-h-913',
520
+ 'fgcz-h-914: cpu 8,mem 30 GB,scr 500G' => 'fgcz-h-914',
521
+ 'fgcz-h-915: cpu 8,mem 30 GB,scr 500G' => 'fgcz-h-915',
522
+ 'fgcz-h-916: cpu 8,mem 30 GB,scr 500G' => 'fgcz-h-916',
523
+ 'fgcz-h-917: cpu 8,mem 30 GB,scr 500G' => 'fgcz-h-917',
524
+ }
525
+ end
526
+ end
527
+
435
528
  end
@@ -1,3 +1,3 @@
1
1
  module WorkflowManager
2
- VERSION = "0.5.5"
2
+ VERSION = "0.5.6"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: workflow_manager
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.5
4
+ version: 0.5.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Functional Genomics Center Zurich
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-06-03 00:00:00.000000000 Z
11
+ date: 2020-06-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler