Here’s the macro in use:
rml::blah[]
And here’s the equivalent in-place listing block:
While working on https://github.com/fidothe/saxon-rb I hit errors in production using a semi-experimental branch (https://github.com/fidothe/saxon-rb/tree/error-reporting) in a threaded XML-processing program.
The errors were the same NoMethodError: undefined method __jcreate_meta!'
as in jruby/jruby#6160, and the program structure is almost identical save for some loading indirection thanks to the use of autoload
.
I am running it in a CI-type environment where 20+ EC2 instances are spun up to process a large amount of data. Most, but not all, runs I'd have one instance's process crash with the error.
Creating an instance of the problem class (https://github.com/fidothe/saxon-rb/blob/error-reporting/lib/saxon/error_reporter.rb, EgClass
in this reproduction case) on the main thread, rather than in the worker threads, has made the problem vanish entirely.
BEFORE: | |
jruby [master] $ benchmark bench/core/string/bench_gsub.rb | |
Warming up -------------------------------------- | |
gsub-string 83.418k i/100ms | |
gsub-regex 120.922k i/100ms | |
gsub-regex-block 82.905k i/100ms | |
gsub-string 96.724k i/100ms | |
gsub-regex 128.786k i/100ms | |
gsub-regex-block 83.732k i/100ms | |
gsub-string 100.446k i/100ms |
MSPEC: {:compile_mode=>"OFF", :format=>"d", :spec_target=>":fast", :jruby_opts=>"-I. --dev", :jit_threshold=>20, :jit_max=>-1, :objectspace_enabled=>true, :thread_pooling=>false, :reflection=>false} | |
rm -rf rubyspec_temp | |
JAVA options: {:dir=>"/work/jruby", :maxmemory=>"1024M", :resultproperty=>"spec.status.OFF", :fork=>"true", :failonerror=>"true", :classname=>"org.jruby.Main"} | |
$ /work/jruby/bin/jruby -J-ea -J-Djruby.launch.inproc=false -J-Djruby.compile.mode=OFF -J-Djruby.jit.threshold=20 -J-Djruby.jit.max=-1 -J-Djruby.objectspace.enabled=true -J-Djruby.thread.pool.enabled=false -J-Djruby.reflection=false -J-Demma.coverage.out.file=target/test-results/coverage.emma -J-Demma.coverage.out.merge=true -J-Demma.verbosity.level=silent -J-XX:MaxMetaspaceSize=512M /work/jruby/spec/mspec/bin/mspec-ci -f d :fast | |
jruby 9.2.9.0-SNAPSHOT (2.5.7) 2019-10-18 29935ad Java HotSpot(TM) 64-Bit Server VM 25.131-b11 on 1.8.0_131-b11 [darwin-x86_64] | |
/work/jruby/spec/ruby/core/module/attr_spec.rb:38: warning: optional boolean argum |
require 'saxon/loader' | |
if ENV['ALT_SAXON_HOME'] | |
Saxon::Loader.load!(ENV['ALT_SAXON_HOME']) | |
end | |
require 'saxon/item_type' |
# The code smell: disjoint radio buttons reveal that some values that | |
# should have hung together didn't, and that there were also dependent | |
# fields (the data protection checkbox and the application form link) | |
# which were hanging around and being a little bit problematic | |
# | |
# A solution is to use one field that can hold several values, unlike the | |
# boolean which can only hold two. | |
# | |
# We can also introduce a VALUE OBJECT that represents this field and can | |
# also tell us which (if any) of the dependent fields are needed. |
use std::ffi::CString; | |
extern crate libc; | |
/* structs and enums-hiding-structs taken from libdvdread: | |
http://git.videolan.org/?p=libdvdread.git;a=blob;f=src/dvdread/dvd_reader.h;h=9c7be9d0d2dcaa7dd003b43ecc00fc791ffec657;hb=refs/heads/master | |
http://git.videolan.org/?p=libdvdread.git;a=blob;f=src/dvdread/ifo_read.h;h=97f4179f0ce95d00d1db0df136a0111a574e71a2;hb=refs/heads/master | |
http://git.videolan.org/?p=libdvdread.git;a=blob;f=src/dvdread/ifo_types.h;h=33f03467b375025ac78c0294e42c321df924ffae;hb=refs/heads/master | |
*/ | |
pub enum DVDReader {} | |
pub enum DVDFile {} |
I got Torch + CUDA working on a Ubuntu 14.04 g2.2xlarge EC2 instance using these instructions. Get the latest CUDA install package by consulting https://developer.nvidia.com/cuda-downloads#linux and grabbing the most recent. (7.0 at time of writing).
I also made a public AMI with this, plus Dan Hon's char-rnn fork pre-installed.
It's ami-9bcadbab
, or dreaming-prose-public
, in the us-west-2
(Oregon) region. You should be able to copy it to another region if you need to. You can launch an instance in the EC2 console at this URL: https://us-west-2.console.aws.amazon.com/ec2/v2/home?region=us-west-2#LaunchInstanceWizard:ami=ami-9bcadbab
You'll need a g2.2xlarge
or g2.8xlarge
instance or there'll be no CUDA for you...
# encoding: utf-8 | |
SEED = 6514 | |
BASE_CMD = "bundle exec rspec --fail-fast --seed #{SEED}" | |
all_potential_files = Dir['spec/controllers/**/*_spec.rb', 'spec/features/**/*_spec.rb'] | |
definitely_involved = ['spec/controllers/concerns/x.rb', 'spec/features/y.rb'] | |
potential_files = all_potential_files.to_a - definitely_involved | |
def attempt(files) |
require 'prawn' | |
require 'prawn/measurements' | |
# I have a small collection of links to the resources I used to figure all | |
# this out: http://pinboard.in/u:fidothe/t:pdfx | |
module PDFX | |
class PageBox | |
include Prawn::Measurements | |
attr_reader :bleed_mm |