Basic Ruby on Rails Work Flow

Bootstrapping in and out:

user@biotite ~ $ cd work/railsapps/ggkbase/

1- Start redis:

user@biotite ~/work/railsapps/ggkbase $ ./redis_init.sh start
Starting redis-server: all set

2- Check that redis is up:

user@biotite ~/work/railsapps/ggkbase $ ps -ef | grep klane
user@biotite ~/work/railsapps/ggkbase $ psgg
user    67702     1  0 10:10 ?        00:00:00 /opt/bin/bio/redis-server 127.0.0.1:0
user@biotite ~/work/railsapps/ggkbase $ tail -f log/redis.log

3- Start  Sidekiq:

user@biotite ~/work/railsapps/ggkbase $ rprails sidekiq:start
Starting Sidekiq…

4- Check that Sidekiq is up:

user@biotite ~/work/railsapps/ggkbase $ ps -ef | grep klane
user@biotite ~/work/railsapps/ggkbase $ psgg
user   52388     1  0 15:48 ?        00:00:26 /opt/bin/bio/redis-server 127.0.0.1:0
user   59270     1  2 15:49 ?        00:02:07 sidekiq 5.0.4 ggkbase [0 of 35 busy]
user@biotite ~/work/railsapps/ggkbase $ tail -f log/sidekiq.log
2017-08-14T17:20:27.710Z 45513 TID-gnrzvgst0 INFO: Running in ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-linux]
2017-08-14T17:20:27.711Z 45513 TID-gnrzvgst0 INFO: Sidekiq Pro 3.5.1, commercially licensed.  Thanks for your support!
2017-08-14T17:20:27.711Z 45513 TID-gnrzvgst0 INFO: Booting Sidekiq 5.0.4 with redis options {:id=>"Sidekiq-server-PID-45513", :url=>"unix:///home/user/work/railsapps/ggkbase/tmp/sockets/redis.sock"

5- Leaving:

user@biotite ~/work/railsapps/ggkbase $ rprails sidekiq:stop
Stopping Sidekiq…
user@biotite ~/work/railsapps/ggkbase $ ./redhttp://ggkbase-help.berkeley.edu/wp-admin/post-new.php#is_init.sh stop

(and check with tail-f log file and psgg as in steps 2 and 4)

Note that log files are continually appended. Run log:clear once in a while to empty them.

Possible Commands:

user@biotite ~/work/railsapps/ggkbase $ bin/rake -T
user@biotite ~/work/railsapps/ggkbase $ bin/thor -T

Importing a Project:

Need: project, path to files

Example:

klane@biotite ~/work/railsapps/ggkbase $ time ./bin/thor importer:bin /data7/ThiocyanateBioreactor/assembly/06142017
_2/s11/ -f BioR1_s11_temp_20_scaffold_min1000 -p kate_test
blablabla
Import everything? y or n  ##can choose to jump to any point in import.

Did it work?

rprails c
p = Project.find "kate_test"
p.is_complete # this should return true

Add organisms to a project:

Need: project name, tab delimited file containing <bin, sample> 

### If tsv was made in excel, remove carriage returns.

Example:

time ./bin/thor batch_project:add_organisms -f ~/some.tsv -p project_name

Pull down the latest code updates from github:

user@biotite ~/work/railsapps/ggkbase $ git pull

Perhaps something went awry:

Clear the redis queue:

redis-cli -h
redis-cli -s tmp/sockits/redis.sock
     FLUSHALL
     OK
     quit

Destroy project:

rprails c
p = Project.last or p = Project.find ”klane_test”
p.safe_destroy(false)
p.contigs.count #should return 0