Difference between revisions of "Rake tasks"

From mx Help Wiki
Jump to: navigation, search
(mx:clean_author_initials *)
m (mx:matrix:load)
 
(One intermediate revision by one user not shown)
Line 12: Line 12:
  
 
'' This is in progress, starred tasks are not recently (re)tested. ''
 
'' This is in progress, starred tasks are not recently (re)tested. ''
 
  
 
=== mx:matrix:load  ===
 
=== mx:matrix:load  ===
Line 19: Line 18:
  
 
<div style="padding: 4px; font-family:courier;">
 
<div style="padding: 4px; font-family:courier;">
  Full_file_name_of_matrix.nex:       # the name of the file, not indented
+
  Full_file_name_of_matrix.nex:               # the name of the file, not indented
     :data_source_ref_id: 12           # a mx Ref#id, referenced everywhere a ref_id is needed
+
     :data_source_ref_id: 12                   # a mx Ref#id, referenced everywhere a ref_id is needed
     :title: "some title"           # the matrix title
+
     :title: "some title"                     # the matrix title
     :data_source_name: "some datasource name"   # the datasource tile (essentially the same thing in this case)
+
     :data_source_name: "some datasource name" # the datasource tile (essentially the same thing in this case)
     :notes: "Some note here."             # <i>not yet implemented</i>
+
     :notes: "Some note here."                 # <i>not yet implemented</i>
     :generate_short_chr_name: true         # creates a truncated character name
+
     :generate_short_chr_name: true           # creates a truncated character name
     :generate_otu_name_with_ds_id: true    # adds the data source ID to the Otu#name  
+
     :generate_otu_name_with_ds_id: 2          # false or DataSource#id, adds the data source ID to the Otu#name  
     :generate_chr_name_with_ds_id: true    # adds the data source ID to the Chr#name
+
     :generate_chr_name_with_ds_id: 4          # false or DataSource#id, adds the data source ID to the Chr#name
     :match_otu_to_db_using_name: false     # attempts to match incoming Otus to Otu#name
+
     :match_otu_to_db_using_name: false       # attempts to match incoming Otus to Otu#name
 
     :match_otu_to_db_using_matrix_name: false # attempts to match incoming Otus to Otu#matrix_name
 
     :match_otu_to_db_using_matrix_name: false # attempts to match incoming Otus to Otu#matrix_name
     :match_chr_to_db_using_name: false     # attempts to match incoming Chrs to Chr#name
+
     :match_chr_to_db_using_name: false       # attempts to match incoming Chrs to Chr#name
     :generate_chr_with_ds_ref_id: false     # needs a valid Ref#id (not tested)
+
     :generate_chr_with_ds_ref_id: false       # needs a valid Ref#id (not tested)
     :generate_otu_with_ds_ref_id: false     # needs a valid Ref#id (not tested)
+
     :generate_otu_with_ds_ref_id: false       # needs a valid Ref#id (not tested)
 
</div>
 
</div>
  

Latest revision as of 12:52, 31 August 2009

Contents

[edit] Setting the environment

Some of the most important tasks for an mx developer are those that move data in and out of the database (tasks starting with "mx:db:"). Since RAILS_ENV defaults to 'production' in our current environment.rb, you have to specify if you want to operate on the development database, for example:

rake mx:db:restore_last RAILS_ENV=development

You can see more about a specific task (if there is more to see) with --describe

rake --describe mx:db:restore_last

[edit] Available mx tasks

This is in progress, starred tasks are not recently (re)tested.

[edit] mx:matrix:load

Loads one or more Nexus formatted matrices. In addition to the matrix file a YAML metadata file is required that looks like:

Full_file_name_of_matrix.nex:                # the name of the file, not indented
   :data_source_ref_id: 12                   # a mx Ref#id, referenced everywhere a ref_id is needed
   :title: "some title"                      # the matrix title
   :data_source_name: "some datasource name" # the datasource tile (essentially the same thing in this case)
   :notes: "Some note here."                 # not yet implemented
   :generate_short_chr_name: true            # creates a truncated character name
   :generate_otu_name_with_ds_id: 2          # false or DataSource#id, adds the data source ID to the Otu#name 
   :generate_chr_name_with_ds_id: 4          # false or DataSource#id, adds the data source ID to the Chr#name
   :match_otu_to_db_using_name: false        # attempts to match incoming Otus to Otu#name
   :match_otu_to_db_using_matrix_name: false # attempts to match incoming Otus to Otu#matrix_name
   :match_chr_to_db_using_name: false        # attempts to match incoming Chrs to Chr#name
   :generate_chr_with_ds_ref_id: false       # needs a valid Ref#id (not tested)
   :generate_otu_with_ds_ref_id: false       # needs a valid Ref#id (not tested)

You can repeat the above for all the matrices you have to add many matrices at once.

[edit] mx:clean_author_initials *

Removes all characters other than A-Z

[edit] mx:db:dump_data

Dumps a copy of the database to /dumps.

[edit] mx:db:reload

Dump the data, recreate the tables a...

[edit] mx:db:restore

Dump the data as a backup, then rest...

[edit] mx:db:restore_last

Dumps the current data to /dumps, then restores the data from the (next) youngest dump file (like "2008_07_03_224250.sql") in /dumps.

[edit] mx:db:setup*

(not working yet)

[edit] mx:fk_schema*

deprecated with upcoming migrations Generate the foreign key statements ...

[edit] mx:load_images

Call like: "rake mx:load_images img_...

[edit] mx:load_languages

should deprecate with migration, a one-time use Loads the language table. Call like: "rake mx:load_languages f...

[edit] mx:matrix:debug

Debug a nexus file against the parser.

[edit] mx:matrix:load

Load one or more matrices.

[edit] mx:prepare_release

Export a copy of the mx source code ...

[edit] mx:setup_directories*

Creates the directories mx uses for ...

[edit] mx:update_ref_display_names*

Update all Ref display_name fields.

Personal tools